Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that STATE configuration from static hints are properly configured with multiple levels of class inheritance #288

Merged
merged 3 commits into from
Nov 1, 2017

Conversation

robframpton
Copy link

No description provided.

Copy link
Contributor

@jbalsas jbalsas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Robert-Frampton, I'm not sure the test is correct, and thus the solution might be incomplete.

Also, while we're at it, the configStateFromStaticHint_ jsdoc says:

/**
 * Adds state keys from super classes static hint `MyClass.STATE = {};`.
 * @param {Object.<string, !Object>=} opt_config An object that maps all the
 *     configurations for state keys.
 * @protected
 */

But I don't see the opt_config used anywhere... can we check to see how was it being used before and update the jsdoc accordingly?

State.STATE_REF_KEY = '__METAL_STATE_REF_KEY__';

/**
* Constant used as key on class constructors that extend form State, stores
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible typo form -> from?

var child = new Child({
key2: 'foo2'
});
assert.strictEqual('foo1', test.key1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be asserting child.key1?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, if you change it to child.key1, the test will fail...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's shouldn't be asserting child.key1, key1 isn't being passed a value for Child. I just left this assertion there to ensure that the static hint configuration of Child doesn't affect the values of the parent it's inheriting from.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see! For some reason I assumed they had defaults!

@robframpton
Copy link
Author

@jbalsas

Here is the commit in question regarding the inaccurate jsdoc, robframpton@fa26e7c.

Looks like it was left over by mistake, that argument was the same as what is now the initialValues_ property. Everything that uses it just accesses the property now rather than passing the argument around. I'll just remove it.

@jbalsas jbalsas merged commit d83b7a6 into metal:develop Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants