Consolidate module federation on a single router with federated route contribution#913
Merged
Merged
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
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 & Motivation
The module federation setup ran two TanStack routers in one browser tab: the main host's browser-history router and a second memory-history router mounted by the account remote. The second router rendered a duplicate copy of the host's entire root shell inside the account subtree (verified by React fiber inspection), duplicating the invitation banner, page tracking, and provider stack, and causing the tenant-switching end-to-end test to fail on freshly opened tabs. Navigation between the two routers was kept in sync by hand with history mutations, a context bridge, and a global guard registry.
./routesfederated module, and the main host grafts it under its root at startup. The nested router, blockable memory history, history sync listeners, navigation context bridge, global guard registry, and route prefix allowlist are deletedBannerContainer(renamed fromBannerPortal) renders banners as ordinary children instead of portals into a shared DOM node looked up by id@tanstack/react-routerand@tanstack/react-queryare enforced module federation singletons, and the federation types generator emits a factory signature for the routes exposecreateRouteris blocked outside the two router hosts,createPortalis blocked in application code, and directhistory.pushState/replaceStatemutation is blockedbeforeLoad, no data loading)Checklist