-
-
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
arrayContentDidChange will often call objectAt(0) and objectAt(len - 1) #14843
Comments
@hjdivad just curious do you know if anyone has a PR with a failing test on this issue? |
@pixelhandler i'm not aware of one |
hjdivad
added a commit
to hjdivad/ember.js
that referenced
this issue
Apr 5, 2017
hjdivad
added a commit
to hjdivad/ember.js
that referenced
this issue
Apr 5, 2017
I like the proposed solution. |
I think this is fixed in #15510 no ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When subclassing
MutableArray
it is surprising that any mutation can triggerobjectAt(0)
andobjectAt(len -1)
. This happens because of the checks here for triggering change events forfirstObject
andlastObject
.This causes some difficulties when dematerializing records in Ember Data, because removing unloaded records from relationships, which is done asynchronously, would cause other records to be rematerialized because the materialization is lazy and the records are retrieved for the sake of this check.
This was reported in #5379 which was never fixed, but was closed in favour of a more limited problem in #5591 which was fixed in #14493.
One possible solution is to trigger changes for
firstObject
andlastObject
only based on the indices of deletions and additions. This will mean that change events will be triggered even in the case of[a,a,b].removeAt(0);
which is not the case today.cc @igorT
The text was updated successfully, but these errors were encountered: