fix(bridge-react): keep host fallback outside remote root#4780
Conversation
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: ff652c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 46 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size Report11 package(s) changed, 30 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 6.80 MB (+184 B (+0.0%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
What changed
Fixes #4588.
The remote React bridge no longer renders the host-provided fallback component inside the remote React root. The remote root now uses its own default fallback boundary, while the host fallback remains available on the host-side boundary created by
createRemoteAppComponent.Why
When host and remote use different React versions, rendering a host fallback component with hooks inside the remote React root can trigger invalid hook calls. Keeping the host fallback on the host side avoids crossing React instances.
Validation
pnpm exec prettier --check packages/bridge/bridge-react/src/provider/versions/bridge-base.tsx packages/bridge/bridge-react/__tests__/bridge.spec.tsx .changeset/clean-react-fallback.mdpnpm --filter @module-federation/bridge-react exec jest --config jest.config.ts __tests__/bridge.spec.tsx --runInBandpnpm --dir packages/bridge/bridge-react exec jest --config jest.config.ts --runInBandpnpm --filter @module-federation/bridge-react run buildpython3.12 .codex/skills/changeset-pr/scripts/run_changeset_status.py --verbosegit diff --checkThe first full package test command was malformed and found no tests; I reran Jest directly from the package directory and all tests passed.