fix(useStorage): cross-document sync solution for custom storage backends#5193
fix(useStorage): cross-document sync solution for custom storage backends#5193Promise2679 wants to merge 3 commits intovueuse:mainfrom
Conversation
…nts when using custom storage backends
9romise
left a comment
There was a problem hiding this comment.
I think the content added in this PR goes outside the responsibility of useStorage.
We also provide useBroadcastChannel, so your use case can be achieved by using useStorage and useBroadcastChannel together.
I think since Anyway, I am just following the TODO's instruction, I'll respect your final decision. |
Oh, I see. In this case, would it be possible to use |
|
yeah I'll have a try |
Before submitting the PR, please make sure you do the following
fixes #123).Description
When using custom storage backends, state changes cannot be synchronized across different documents.
Here is a simple example. If you open two tabs and click the button in tab A, tab B will not update the value instantly.
As mentioned in notes, I solved this by using a BroadcastChannel object to send and receive data.
Additional context