-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Describe the problem
The svelte store paradigm currently uses a breadth-first signaling pattern to solve the "diamond dependency problem".
This is a good solution, but the internal queue (subscriber_queue) is a hidden internal variable and this means that when writing a new store implementation, there will be issues with interoperability.
i.e. the signaling will no longer be perfectly "breadth first" and thus issues like the diamond dependency will be intractable when mixing store types.
See this REPL for an illustration of the problem
https://svelte.dev/repl/b9506f52bba44c158d4cddf996252ee0?version=3.42.1
Describe the proposed solution
I would recommend the internal signal queue (subscriber_queue) be exposed as a small API.
Internally the queue could be represented as an array of actions, allowing broader extensibility.
Notably svelte-immer-store internally signals with more than just new_value, and a queue of actions would allow authors to adopt their own requirements.
I would be happy to develop and submit a pull request to solve this issue. But I would like guidance to make sure the effort was not wasted.
Alternatives considered
The only other alternative I can find is to avoid mixing the stores, but that means no interoperability between libraries.
Importance
i cannot use svelte stores without it
Edit: should have said i cant use svelte stores. Svte itself is still good 😅