Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Runtime share singleton not work. #3459

Open
5 tasks done
Onlylonger opened this issue Jan 22, 2025 · 3 comments
Open
5 tasks done

Runtime share singleton not work. #3459

Onlylonger opened this issue Jan 22, 2025 · 3 comments

Comments

@Onlylonger
Copy link

Describe the bug

Hub(Consumer) resolve plugin(provider) function which return JSX.Element. which will console.error info below:

Image

Image

Image

I have looked document and add config in hub and plugin. but not work

Reproduction

https://github.com/Onlylonger/ha

Used Package Manager

pnpm

System Info

System:
    OS: macOS 15.1.1
    CPU: (8) arm64 Apple M1
    Memory: 67.20 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.11.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    pnpm: 9.12.3 - ~/.nvm/versions/node/v22.11.0/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.265
    Safari: 18.1.1

Validations

@danpeen
Copy link
Contributor

danpeen commented Jan 23, 2025

let me check.

@danpeen
Copy link
Contributor

danpeen commented Jan 23, 2025

@Onlylonger To solve this problem, let's set shareStrategy: 'loaded-first' in both hub and plugin-a like this:

Image

then it will work:

Image

its origin error is caused by multiple react instances, and something wrong happened in the process of react and react-dom sharing.

@philwronski
Copy link

same error here, i tried shareStrategy: 'loaded-first' but it doesn't work. On the other hand, using the react bridge works, but it's not optimal for sharing a component with a state.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants