-
-
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
[CLEANUP beta] Remove deprecated array observers #19833
[CLEANUP beta] Remove deprecated array observers #19833
Conversation
a5f28d2
to
2430326
Compare
2430326
to
825bf5f
Compare
* Array proxies have a `_revalidate` method which must be called to set | ||
* up their internal array observation systems. | ||
*/ | ||
obj._revalidate?.(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this patch hasArrayObserver
has been removed. That property was not directly deprecated in 3.x, however we've removed a number of APIs in this patch which were related to someArray.addArrayObserver
(APIs which were only meaningful once you had an observer installed).
Because it is removed, it no longer needs to be notified of change. However the _revalidate
hook on ArrayProxy
instances was being called via PROPERTY_DID_CHANGE
symbol notification. Without trying to rewrite that system we have two options: Either call _revalidate()
directly, or keep the property hasArrayObserver
around just to trigger the PROPERTY_DID_CHANGE
. Here I've chosen to call _revalidate()
directly.
ebcf3a1
to
d374744
Compare
Part of emberjs#19617 * Remove `someArray.addArrayObserver` https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L532 * Remove `someArray.removeArrayObserver` https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L548 * Remove `someArray.hasArrayObservers` https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L571 * Remove `someArray.arrayContentWillChange` https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L642 * Remove `someArray.arrayContentDidChange` https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L670 (also at https://github.com/emberjs/ember.js/pull/19833/files#diff-79a0015ca0e6a6c3661d9119f4caf6b26b111af6bb0e5bb784558631c599a81cL357) * On the internal version of `addArrayObserver`, remove the optionality of `willChange` and `didChange` arguments to name the hooks. In framework code (and now in test) these are always provided. * Retain basically all the test coverage of array observers since they remain used by `ArrayProxy` internally (and through that interface, in Ember Data). Co-authored-by: Matthew Beale <[email protected]>
d374744
to
a9aedea
Compare
Part of #19617
Supplants #19746
someArray.addArrayObserver
https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L532someArray.removeArrayObserver
https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L548someArray.hasArrayObservers
https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L571someArray.arrayContentWillChange
https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L642someArray.arrayContentDidChange
https://github.com/emberjs/ember.js/pull/19833/files#diff-8116921433c6e1664250d5735e4f9daeb6ea9e00940783e0c4db7adf88aa8772L670 (also at https://github.com/emberjs/ember.js/pull/19833/files#diff-79a0015ca0e6a6c3661d9119f4caf6b26b111af6bb0e5bb784558631c599a81cL357)addArrayObserver
, remove the optionality ofwillChange
anddidChange
arguments to name the hooks. In framework code (and now in test) these are always provided.ArrayProxy
internally (and through that interface, in Ember Data).Co-authored-by: Matthew Beale [email protected]