Skip to content

fix(bridge-react): keep host fallback outside remote root#4780

Open
2heal1 wants to merge 2 commits into
mainfrom
fix/4588-react-fallback-compat
Open

fix(bridge-react): keep host fallback outside remote root#4780
2heal1 wants to merge 2 commits into
mainfrom
fix/4588-react-fallback-compat

Conversation

@2heal1
Copy link
Copy Markdown
Member

@2heal1 2heal1 commented May 28, 2026

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.md
  • pnpm --filter @module-federation/bridge-react exec jest --config jest.config.ts __tests__/bridge.spec.tsx --runInBand
  • pnpm --dir packages/bridge/bridge-react exec jest --config jest.config.ts --runInBand
  • pnpm --filter @module-federation/bridge-react run build
  • python3.12 .codex/skills/changeset-pr/scripts/run_changeset_status.py --verbose
  • git diff --check

The first full package test command was malformed and found no tests; I reran Jest directly from the package directory and all tests passed.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 28, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit ff652c2
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a1802553282980008a3e1fc
😎 Deploy Preview https://deploy-preview-4780--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: ff652c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 46 packages
Name Type
@module-federation/bridge-react Patch
@module-federation/modern-js-v3 Patch
@module-federation/modern-js Patch
remote5 Patch
remote6 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/rspress-plugin Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/metro Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/esbuild Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/observability-plugin Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/utilities Patch
website-new Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Bundle Size Report

11 package(s) changed, 30 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/bridge-react 376.6 kB +184 B (+0.0%) 1.3 kB +1 B (+0.1%)
@module-federation/cli 26.3 kB no change 786 B no change
@module-federation/core 39.1 kB no change 173 B no change
@module-federation/devtools 664.0 kB no change 4.0 kB no change
@module-federation/enhanced 807.9 kB no change 672 B no change
@module-federation/managers 69.8 kB no change 334 B no change
@module-federation/manifest 136.1 kB no change 182 B no change
@module-federation/metro-plugin-rnc-cli 0 B no change 314 B no change
@module-federation/node 193.4 kB no change 217 B no change
@module-federation/storybook-addon 77.9 kB no change 100 B no change
@module-federation/utilities 110.6 kB no change 328 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/bridge-react 17.9 kB +9 B (+0.0%) 18.3 kB +10 B (+0.1%)
@module-federation/cli 2.3 kB -31 B (-1.3%) 2.3 kB -31 B (-1.3%)
@module-federation/core 1.1 kB -31 B (-2.8%) 1.0 kB -30 B (-2.8%)
@module-federation/devtools 30.2 kB -27 B (-0.1%) 30.2 kB -27 B (-0.1%)
@module-federation/enhanced 2.6 kB -43 B (-1.6%) 2.6 kB -43 B (-1.6%)
@module-federation/managers 2.4 kB -27 B (-1.1%) 2.4 kB -27 B (-1.1%)
@module-federation/manifest 6.1 kB -39 B (-0.6%) 6.1 kB -39 B (-0.6%)
@module-federation/metro-plugin-rnc-cli 411 B -26 B (-5.9%) 411 B -26 B (-5.9%)
@module-federation/node 9.2 kB -27 B (-0.3%) 9.2 kB -27 B (-0.3%)
@module-federation/storybook-addon 1.9 kB -24 B (-1.2%) 1.7 kB -24 B (-1.3%)
@module-federation/utilities 2.6 kB -31 B (-1.2%) 2.6 kB -31 B (-1.2%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 21.4 kB -16 B (-0.1%) 22.5 kB -16 B (-0.1%) +1.1 kB 0 B

Total dist (raw): 6.80 MB (+184 B (+0.0%))
Total ESM gzip: 78.3 kB (+1 B (+0.0%))
Total web bundle (gzip): 206.5 kB (-297 B (-0.1%))
Total node bundle (gzip): 207.0 kB (-295 B (-0.1%))
Tracked ./bundler entry gzip: 556 B (no change)
Tracked ./bundler web bundle (gzip): 4.8 kB (no change)
Tracked ./bundler node bundle (gzip): 4.8 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@ff652c2

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@ff652c2

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@ff652c2

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@ff652c2

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@ff652c2

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@ff652c2

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@ff652c2

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@ff652c2

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@ff652c2

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@ff652c2

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@ff652c2

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@ff652c2

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@ff652c2

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@ff652c2

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@ff652c2

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@ff652c2

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@ff652c2

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@ff652c2

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@ff652c2

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@ff652c2

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@ff652c2

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@ff652c2

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@ff652c2

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@ff652c2

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@ff652c2

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@ff652c2

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@ff652c2

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@ff652c2

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@ff652c2

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@ff652c2

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@ff652c2

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@ff652c2

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@ff652c2

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@ff652c2

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@ff652c2

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@ff652c2

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@ff652c2

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@ff652c2

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@ff652c2

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@ff652c2

commit: ff652c2

@2heal1 2heal1 marked this pull request as ready for review May 28, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bridge-react] Remote directly using host passed fallback component

2 participants