Sync State Function #255
Replies: 3 comments 8 replies
-
I don't think there is another way to do this because it gives you another reference. But why do you need this check? It should emit only when the store's value changes. |
Beta Was this translation helpful? Give feedback.
-
If you want to, I can put more love to the code: add options to change the broadcast name, sync only a state subset, add a good set of tests and add a pull request as a new package |
Beta Was this translation helpful? Give feedback.
-
I've just pushed the working library with the tests, some documentation and the NPM package as you said. If you want to add it to the main package just copy and paste and I'll delete this repo ;) |
Beta Was this translation helpful? Give feedback.
-
Hello.
I've been doing a simple POC for a sync-state function based in
BroadcastChannel
that works well with persist-state (see here and open in multiple tabs), but the only way I found to check if there are changes is with anisEqual
function.I think this could end up giving performance problems, and maybe there is another way to discriminate a specific type of mutation to publish the message, although reviewing the code I have not found it. Someone with a better idea about how to implement this?
I think that this could be a good library to add to 🧝.
Beta Was this translation helpful? Give feedback.
All reactions