Skip to content

docs(bridge): clarify createLazyComponent error handling - #4945

Open
dmchoi77 wants to merge 1 commit into
module-federation:mainfrom
dmchoi77:docs/bridge-lazy-error-boundary
Open

docs(bridge): clarify createLazyComponent error handling#4945
dmchoi77 wants to merge 1 commit into
module-federation:mainfrom
dmchoi77:docs/bridge-lazy-error-boundary

Conversation

@dmchoi77

Copy link
Copy Markdown
Contributor

Description

Clarify the documented error-handling behavior of createLazyComponent.

The previous documentation stated that the API included an Error Boundary and that fallback handled rendering failures. However, the implementation only uses fallback for remote module loading and data-fetch failures. Errors thrown while rendering the loaded component or its descendants must be handled separately.

This PR:

  • removes claims that createLazyComponent includes an Error Boundary;
  • documents the actual scope of fallback;
  • explains that client-side render errors require a Host Error Boundary;
  • clarifies that server-rendering errors must be handled by the server rendering pipeline;
  • keeps the English, Simplified Chinese, and Brazilian Portuguese documentation aligned.

This is a documentation-only change. It does not change runtime behavior or the public API.

Validation:

  • pnpm exec prettier --check apps/website-new/docs/en/guide/bridge/react/load-component.mdx apps/website-new/docs/zh/guide/bridge/react/load-component.mdx apps/website-new/docs/pt-BR/guide/bridge/react/load-component.mdx

Related Issue

N/A

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f15fb18

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f15fb1891f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +184 to +186
The error component rendered when remote module loading or data fetching fails.

It does not catch errors thrown while React renders the loaded component or its descendants. To handle client-side render errors, wrap the lazy component in an Error Boundary in the host application. Server-rendering errors must be handled by the server rendering pipeline because React Error Boundaries do not catch them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include lazy-resolution failures in Error Boundary guidance

When the configured export is missing or is not a function—or when the loader's second invocation rejects—the error is thrown from the React.lazy factory (packages/bridge/bridge-react/src/lazy/createLazyComponent.tsx:286-338), outside the fallback handling around getData. Thus fallback does not cover every remote-module loading/resolution failure as stated here, while the following guidance only mentions errors thrown by the loaded component or its descendants. Document that these lazy-resolution errors also require a host Error Boundary so users do not rely on fallback for a misconfigured export or second-load failure.

Useful? React with 👍 / 👎.

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.

1 participant