-
-
Notifications
You must be signed in to change notification settings - Fork 379
bridge-react: stabilize rerender and defer destroy to post-render #4285
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
Draft
ScriptedAlchemy
wants to merge
23
commits into
main
Choose a base branch
from
patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+964
−91
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path.join is not meant for URLs. Code does not work in Node > 22.11 and produces an Invalid URL. Fixing by setting the origin as the URL base.
Fixes CI format check failure by adding required trailing comma.
- Add rerender option to ProviderFnParams interface for custom rerender handling - Update bridge-base implementation to support custom rerender logic - Add component state tracking to detect rerenders vs initial renders - Preserve component state when shouldRecreate is false - Maintain backward compatibility for existing code - Add comprehensive test suite for rerender functionality Fixes #4171
- Fix shouldRecreate: true to actually unmount and recreate the root - Implement proper root recreation with fresh React root instance - Add comprehensive test to verify recreation behavior - Ensure state is truly reset when shouldRecreate is true - Maintain proper cleanup of old roots before creating new ones - Add changeset for version bumping - Remove test-implementation.js file (tests are in proper package location) This addresses the issue where shouldRecreate: true was not actually recreating the component and resetting state as promised in the API.
- Fix shouldRecreate: true to actually unmount and recreate the root - Implement proper root recreation with fresh React root instance - Add comprehensive test to verify recreation behavior - Ensure state is truly reset when shouldRecreate is true - Maintain proper cleanup of old roots before creating new ones This addresses the issue where shouldRecreate: true was not actually recreating the component and resetting state as promised in the API.
- Revert packages/typescript/src/plugins/FederatedTypesPlugin.ts to main branch version - This file was not intended to be part of the bridge-react rerender functionality PR - Keep PR focused only on bridge-react changes for issue #4171
- use stable element types (no nested component defs) - create root only on first render; reuse for updates - emit before/after destroy hooks when recreating - honor custom render: skip re-creating root on updates
…custom render invocation counts
… root has no render() Add tests to cover fallback behavior and ensure UI updates + custom render is invoked again.
…void prop injection leak
…ert lifecycle emits on key remount
…es in bridge-base and tests
🦋 Changeset detectedLatest commit: e9feea6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary\n- Stabilizes remote component rerendering in bridge-react and preserves instance state.\n- Defers destroy via queueMicrotask to avoid unmounting during React render phase.\n\nKey Changes\n- createBaseBridgeComponent: adds optional rerender hook, tracks root/component/props per DOM, builds stable element tree, avoids double render when custom render handles it.\n- RemoteAppWrapper: serializes props to a stable dependency (propsStr) for predictable updates.\n- Destroy lifecycle: moves destroy into microtask to prevent render-phase teardown issues and emits before/after hooks in order.\n\nTests\n- Adds packages/bridge/bridge-react/tests/rerender-issue.spec.tsx covering:\n - custom rerender hook being called on prop updates,\n - backward compatibility without rerender option,\n - state/instance preservation across updates,\n - fallback path invokes custom render again on updates.\n\nFiles Touched\n- packages/bridge/bridge-react/src/provider/versions/bridge-base.tsx\n- packages/bridge/bridge-react/src/remote/component.tsx\n- packages/bridge/bridge-react/tests/rerender-issue.spec.tsx\n\nNotes\n- Addresses behavior observed in Issue #4171 (rerender).\n- Maintains existing lifecycle hook ordering and logging.