Skip to content

[store-zustand] race conditions with states #12

@Ainias

Description

@Ainias

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions