-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including a library, that builds on React, in a remote results into "Cannot read properties of null (reading 'useRef')" #534
Comments
Here's an issue raised before, its not being fixed |
Any solution to this issue, I am facing exact above error when remote is loading AG-Grid. |
same issue, any solution? @bluedusk @vinodloha @pganster |
same issue, any solution? @bluedusk @vinodloha @pganster |
Same issue. I have configuration object on my remote which is used to pass on 2 views with their routing data. React is designated as shared in both configs. View 1 has nested components, useState and useEffect in itself, but no react hooks within the nested components. Renders without issue. For whatever reason, once we go down a level in the component tree of the remote, it just stops being able of finding React, essentially rendering this entire plugin unusable for most complex applications. Given that this issue seems to have been around for over 2 years now with neither a reliable workaround or an update from the developers. I am giving up faith that this will ever be fixed and will explore alternative solutions. |
same issue, any solution? |
@colerss did you find any alternative for vite for microfrontends? I have the same issue. |
@colerss am facing exactly same issue, the app am building is complex, was using shadcn, it works fine on remote but on host it gives error : Cannot read properties of null (reading 'useRef'). Have you found any solution or alternative? |
Unfortunately, same issue :( |
me facing same issue, with react-apexcharts in remote app |
Same here |
Ok, an update after some investigating: if you are using a modern bundle of your library, it seems the federation plugin can't handle it. So, for instance, my solution for react-simple-keyboard is to import the modern index bundle of the component and boom the problem solved, seems that if the federation plugin has a dependency with some legacy JS browser support it can be generate problems |
Versions
Reproduction
Essentially I just cloned your react-vite example and added the react-image-gallery library in the remote app. When opening the remote app directly, the gallery is shown as expected. BUT if you open the host app, you will get the error
Cannot read properties of null (reading 'useRef')
.Steps to reproduce
pnpm install && pnpm run build && pnpm run serve
localhost:5000
When opening
localhost:5001
, the error does not occur.What is Expected?
No error to occur when opening the host app.
What is actually happening?
The error
Cannot read properties of null (reading 'useRef')
occurring and breaking the host and remote app.The text was updated successfully, but these errors were encountered: