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

[BUGFIX RELEASE] Fix toString to not add the property on the class #13333

Merged
merged 1 commit into from
Apr 14, 2016
Merged

[BUGFIX RELEASE] Fix toString to not add the property on the class #13333

merged 1 commit into from
Apr 14, 2016

Conversation

kratiahuja
Copy link
Contributor

@kratiahuja kratiahuja commented Apr 14, 2016

When calling toString() method on an Ember Object, it attaches the toString as a class property for the first time. This does not seem right since this should be on the prototype of the class. We could memoize the value on the class meta data.

In v2.5.0 and above, when calling .set() on an Ember Object, you end up also attaching the toString() property on the class. This PR calls toString() on the object during setting any property. Therefore, when you walk through the object properties you end up getting an additional property on the object.

Thanks to Kris & Chad for guiding on this!

cc: @krisselden @chadhietala

When calling `toString()` method on an Ember Object, it attaches the `toString` as a class property for the first time. This does not seem right since this should be on the prototype of the class. We could memoize the value on the class meta data.

In v2.5.0 and above, when calling `.set()` on an Ember Object, you end up also attaching the `toString()` property on the class. This [PR](3a2486e) calls `toString()` on the object during setting any property. Therefore, when you walk through the object properties you end up getting an additional property on the object.

cc: @krisselden @chadhietala
@kratiahuja kratiahuja changed the title Fix toString to not add the property on the class [BUGFIX RELEASE] Fix toString to not add the property on the class Apr 14, 2016
@chadhietala
Copy link
Contributor

This looks good to me, CI just needs to be bounced once #13334 lands. Currently master is 🔴 .

@krisselden
Copy link
Contributor

@rwjblue just to explain this, toString() mutates the shape of object and in the 2.5.0 release an assertion called object toString() in Ember.set() and while in production, asserts are stripped this failed tests that were asserting keys() because Ember.set() was adding a toString() to this.

@krisselden krisselden merged commit 4f4bc17 into emberjs:master Apr 14, 2016
@kratiahuja kratiahuja deleted the fixToString branch April 14, 2016 22:22
@rwjblue
Copy link
Member

rwjblue commented Apr 14, 2016

I have no clue why we would want to write toString to the instance anyways (maybe some work around for another issue). This seems good.

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.

4 participants