Skip to content

Moving _componentMap property inside the ReactJsonSchema class #12

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

Merged

Conversation

nlaffey
Copy link
Contributor

@nlaffey nlaffey commented Jun 19, 2017

Currently _componentMap is a let that sits outside of the ReactJsonSchema class. When multiple instances of the class are created they unfortunately share the value of whichever instance set the value last. This PR moves the value inside of the class so that each instance gets to keep its own _componentMap.

@nlaffey nlaffey requested a review from eiof June 19, 2017 19:39
@nlaffey nlaffey force-pushed the allow_multiple_instances_with_different_component_maps branch from b376e51 to 2940df5 Compare June 19, 2017 19:42
@nlaffey nlaffey changed the title Moving _componentMap property inside the ReactJsonSchema class so tha… Moving _componentMap property inside the ReactJsonSchema class Jun 19, 2017
@@ -34,7 +34,7 @@ var ReactJsonSchema = function () {
}, {
key: 'parseSubSchemas',
value: function parseSubSchemas() {
var subSchemas = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
var subSchemas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like this is compiling different? I assume this is ok and its just the result of the compiler version...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, compiler probably updated to && for better performance (doesn't perform right hand evaluation if left hand fails, unlike ||).

@nlaffey nlaffey merged commit 5296285 into master Jun 27, 2017
@elsif00 elsif00 deleted the allow_multiple_instances_with_different_component_maps branch July 27, 2017 20:42
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