Skip to content
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

Shell App fails to reflect Remote App updates in SSR until hydration #3548

Open
5 tasks done
quinhatpy opened this issue Feb 26, 2025 · 1 comment
Open
5 tasks done

Comments

@quinhatpy
Copy link

Describe the bug

Description:
When running a shell application that consumes remote applications using Module Federation, updates to the remote app content are not reflected in the shell app during server-side rendering (SSR). The updated content only appears after client-side hydration, and an error is logged in the browser console.

Steps to Reproduce:

  1. Setup:
  • Shell app runs on port 3000.
  • Remote 1 app runs on port 3001.
  • Remote 2 app runs on port 3002.
  1. When running pnpm start for the shell app and accessing it at localhost:3000, everything loads correctly.
  2. When updating content in Remote 1 app (running on port 3001), we re-run pnpm start to rebuild and serve it.
  3. After refreshing the shell app in the browser, the content from Remote 1 does not auto-update during SSR.
  4. The content only updates after hydration, and we see the following error in the browser's console:
Uncaught Error: Minified React error #425; visit https://reactjs.org/docs/error-decoder.html?invariant=425 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

  1. If we block JavaScript, the content from Remote 1 is not updated.
  2. If we restart the shell app using pnpm serve (not need re-build) and refresh the browser at localhost:3000, the content from Remote 1 is updated correctly.

Expected Behavior:
The content of Remote 1 should auto-update immediately in the Shell App after rebuilding and running the Remote 1 app server. The SSR page should reflect these updates without needing to wait for hydration or a full shell app restart.

Reproduction

https://github.com/quinhatpy/react-18-ssr-rspack

Used Package Manager

pnpm

System Info

System:
    OS: macOS 15.3
    CPU: (11) arm64 Apple M3 Pro
    Memory: 88.42 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: 9.10.0 - ~/.nvm/versions/node/v20.17.0/bin/pnpm
  Browsers:
    Chrome: 133.0.6943.128
    Edge: 133.0.3065.82
    Safari: 18.3

Validations

@quinhatpy quinhatpy changed the title Shell App Fails to Reflect Remote App Updates in SSR Until Hydration Shell App fails to reflect Remote App updates in SSR until hydration Feb 26, 2025
@ScriptedAlchemy
Copy link
Member

you need to clear require cache. look at the hot-reload functions in module-federation/node package

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

No branches or pull requests

2 participants