Skip to content

Zustand store is created multiple times #4283

@hqlinh

Description

@hqlinh

Describe the bug

I have a host app and a remote app. They both use the same react and zustand version.
The host app exposes zustand store. The remote app exposes a react component.
When I start 2 apps, zustand store is created 2 times, leading 2 instances are created. One for host app, and one for remote app.
When update store from zustand, the value of store in remote doesn't change.

Reproduction

https://github.com/hqlinh/microfrontend

Used Package Manager

yarn

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M2
    Memory: 106.80 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.19.0 
    Yarn: 1.22.22 
    npm: 10.9.3 
    pnpm: 10.17.0
  Browsers:
    Chrome: 143.0.7499.170
    Firefox: 139.0.4
    Safari: 17.6

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions