-
Notifications
You must be signed in to change notification settings - Fork 2
[store-zustand] race conditions with states #12
Copy link
Copy link
Open
Description
If you send multiple updates from different content scripts simultaniously, only the last one will be saved.
In my example I have a record inside the store. My state is
{
characters: Record<string, string[]>
} And I open multiple iFrames, each one collecting data for a single character.
Often times the data is collected at the same time, so two or more content scripts are sending the full state to the backend-script. But they do not have the state (character infos) from the other iFrames and therefore only the last state is saved correctly.
Maybe a state-update method (like shallow-merge/deep-merge) could be added to the initPegasusZustandStoreBackend-State. And deleting of states must be set to null or undefined directly?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels