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

Errors occur when store dependents rely on passed data AND direct data from store #1520

Closed
jacwright opened this issue Jun 1, 2018 · 1 comment

Comments

@jacwright
Copy link
Contributor

When store data is set, the store updates each dependent in turn. This can cause errors when a child of a dependent earlier in the array of dependents is updated by its parent because store data is passed to it (for example, when iterating over an array of data). The child will have fresh data passed in but stale data from the store because it hasn't been updated yet.

Example: https://svelte.technology/repl?version=2.7.0&gist=66f200b11052eae7c6f45fc99a4a96c8

A thought on how to fix this is to update the context/data of each item in once pass and then do another render pass. This should also eliminate multiple re-renders that will occur by the user working around the above issue.

@btakita btakita mentioned this issue Jun 17, 2018
jacwright added a commit that referenced this issue Aug 15, 2018
Proposed fix for #1520. Provides a starting point for discussion.
jacwright added a commit that referenced this issue Aug 23, 2018
Proposed fix for #1520. Provides a starting point for discussion.
Rich-Harris added a commit that referenced this issue Aug 25, 2018
Rich-Harris added a commit that referenced this issue Aug 25, 2018
Rich-Harris added a commit that referenced this issue Aug 26, 2018
@Rich-Harris
Copy link
Member

Released 2.13.2 with the fix — closing

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

No branches or pull requests

2 participants