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

Merge pull request #18703 from emberjs/bugfix/fix-array-proxy-tags #18703

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

pzuraq
Copy link
Contributor

@pzuraq pzuraq commented Jan 25, 2020

Currently, if arrangedContent is overridden in an ArrayProxy with a
computed 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 propagate
changes. 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 those
changes. 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

Currently, if `arrangedContent` is overridden in an ArrayProxy with a
computed 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 propagate
changes. 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 those
changes. 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.
@rwjblue rwjblue changed the title [BUGFIX release] Correctly links ArrayProxy tags to arrangedContent Merge pull request #18703 from emberjs/bugfix/fix-array-proxy-tags Jan 30, 2020
@rwjblue rwjblue merged commit f357405 into master Jan 30, 2020
@rwjblue rwjblue deleted the bugfix/fix-array-proxy-tags branch January 30, 2020 20:02
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.

[3.13+] ArrayProxy not rerendering
2 participants