-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] ArrayProxy#content should not be a computed property #12860
Conversation
Fixes emberjs#12475. This commit restores the contract of ArrayProxy content being a simple property instead of a computed property. This prevents accidental clobberings such as in ember-data: https://github.com/emberjs/data/blob/v2.3.3/addon/-private/system/record-arrays/record-array.js#L44 This commit also removes a private hook `arrangedContentArrayWillChange`. In the interest of keeping this bugfix commit minimal, we will continue removing the will* hooks on canary.
We still don't have a root cause analysis of this bug. I suspect it is revealing a problem deeper in ember-metal. Maybe one of the ones @stefanpenner uncovered recently. [Edit to add: I was referring to https://github.com//pull/12832, but it's unclear to me whether there are any real remaining bugs there once we stopped trolling ourselves with array prototype extension issues in the tests themselves.] CP clobbering should cause the |
Should we hold off on merging this until we've attempted to find the root cause? I'm looking now :) |
@ef4: Actually, I got it backwards. The problem is not with clobbering. In fact, the places where ember-data clobbers the The bug seems to occur in the call to |
I would like to review this. But won't have time until Monday |
@stefanpenner - Have you had a chance to review? |
@rwjblue: Once @stefanpenner signs off I will update the commit message. It does not have the correct reasoning. |
I would like to know why this breaks. Unfortunately I didn't end up having time tonight. |
we should also mark arrangedContent as something that will be deprecated |
The old array proxy set up before and "after" observers for Consequently, every call to The ArrayProxy bug occurred when we moved the logic out of a before observer and into a setter. The problem with this is that setters are always called, but before observers are only called if they are being watched. Since we left the "after" observer logic the way it was, this caused an asymmetry in calls to As stated earlier, the extra call to Sorry for the messy explanation. It's a tricky bug to explain. Especially at 4 AM 🌝 |
@mmun - Thanks for the detailed walk through! |
Thanks @mmun 👏 |
For those interested, this should end up in 2.4.0-beta.2 and 2.3.1. |
Fixes #12475.
UPDATE: This reasoning isn't correct. See #12860 (comment).
This commit restores the contract of ArrayProxy content being a simple property instead of a computed property. This prevents accidental clobberings such as in ember-data:
https://github.com/emberjs/data/blob/v2.3.3/addon/-private/system/record-arrays/record-array.js#L44
This commit also removes a private hook
arrangedContentArrayWillChange
and partially removes another private hookarrangedContentWillChange
. In the interest of keeping this bugfix commit minimal, we will continue removing the will* hooks on canary.As the bug was caused by ember-data clobbering a descriptor, there is no simple way to test this within ember. I would recommend adding an integration test to ember-data that covers this case.
cc @krisselden @stefanpenner @ef4 @fivetanley