-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Diamond store dependencies #2660
Comments
I think this is something that's niche enough that we don't want to make the existing store implementations bigger by supporting it, nor do we want to make the API surface more confusing by adding a separate implementation that does something like this. If someone needs this sort of thing, they can implement it themselves - thanks to the simple store contract, Svelte can easily subscribe to stores that aren't based on any of its built-in stores. |
@zmitry you may be interested in https://github.com/TehShrike/warg/ which solves the problem in a similar way to mobx, and is a valid Svelte store. |
component: svelte/store;
issue: diamond dependencies for derived values
repl: https://svelte.dev/repl?version=3.1.0&gist=0f3250ae87011dc9a91e8e4ab8ddd6f9
For diamond dependencies you have issue with unnecessary updates which affects to useless component rerendering or unnecessary computations.
You can solve this issue with approach similar to mobx https://github.com/mobxjs/mobx/blob/a5cb65926621266716f8d11d716bf337e60dc3c1/src/core/observable.ts#L136
Or I think it's doable with topological ordering of stores. The issue with that stores might be created at runtime and even from js files.
The text was updated successfully, but these errors were encountered: