Merge pull request #18703 from emberjs/bugfix/fix-array-proxy-tags #18703
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if
arrangedContent
is overridden in an ArrayProxy with acomputed property that depends on changes to another array/context,
those changes will not propagate correctly. This is because we never
link the tags of the ArrayProxy to the corresponding tags of the
arrangedContent
, instead relying on array observers to propagatechanges. This works when the underlying array is being changed directly,
but doesn't work if the array is being replaced entirely (e.g. the
computed property has invalidated and needs to recompute).
This PR ensures that ArrayProxy tags are setup correctly, so that if
arrangedContent
ever changes, the proxy will also propagate thosechanges. This will affect anything that depends on the ArrayProxy
directly, such as
{{#each}}
loops and other computed properties.One side effect of this is that ArrayProxy's no longer need to manually
dirty themselves, and in fact attempting to do so can trigger the
backtracking rerender assertion (specifically when the proxy first
attempts to update/synchronize while rendering). Internally, a boolean
flag has been added to the array change methods to allow it to opt-out
of sending a notification.
Fixes #18689