TanStack Router page adapter. Projects the framework's AppHistoryApi
into a TanStack history with app-absolute paths, and
renders the page under a TanStack route tree. Never writes
window.history via push/replace.
Declare it by rendering it inside the lazily loaded page or sub-page component that
should get the context:
// In the lazily loaded page component module: exportfunctionToolsPage() { return ( <TanStackPageRouter> {routes} </TanStackPageRouter> ); }
In a sub-page's component it scopes itself to that sub-page rather than to
the page above it, because the sub-page's own mount is what is in context
there. Adapters nest rather than replace one another, so a TanStack sub-page
works under a page rendered by any other routing library, and the reverse.
The content is opaque: whichever sub-page of a page is showing has already
been decided by the framework's own route matching, so this adapter never
builds a route for one — and is never handed another library's route tree
to host. If the content uses another routing library internally, that is
the page author's choice, made alongside their choice of this adapter.
Programmatic back and forward traverse the app-owned browser history.
Custom histories without entry metadata expose one synthetic slot and cannot
provide entry-based restoration or back availability. Push and replace use
native TanStack actions; host traversals without metadata have no known delta.
Custom hosts must update their location snapshot synchronously for push and
replace; traversal notifications can arrive asynchronously.
Cross-adapter navigation blockers are not supported because there is no
shared blocker seam; useBlocker still works for navigation initiated
through this page's own TanStack <Link> / router.navigate.
Scoping needs two things: a page mount, saying which part of the URL belongs
to the page, and a registered AppHistoryApi to project a history from.
With either missing this adapter renders children untouched — no route
tree is built, no router is created — and demands nothing of the surrounding
app: no API provider, no framework context. That passthrough is what lets
one component wrap itself in the adapter and still ship for both frontend
systems: under the old frontend system there is no page mount and no app
history, and the wrap has to be invisible rather than a crash. The same
holds in a plugin's own render() unit tests.
TanStack Router page adapter. Projects the framework's
AppHistoryApiinto a TanStack history with app-absolute paths, and renders the page under a TanStack route tree. Never writeswindow.historyvia push/replace.Declare it by rendering it inside the lazily loaded page or sub-page component that should get the context:
In a sub-page's component it scopes itself to that sub-page rather than to the page above it, because the sub-page's own mount is what is in context there. Adapters nest rather than replace one another, so a TanStack sub-page works under a page rendered by any other routing library, and the reverse.
The content is opaque: whichever sub-page of a page is showing has already been decided by the framework's own route matching, so this adapter never builds a route for one — and is never handed another library's route tree to host. If the content uses another routing library internally, that is the page author's choice, made alongside their choice of this adapter.
Programmatic back and forward traverse the app-owned browser history. Custom histories without entry metadata expose one synthetic slot and cannot provide entry-based restoration or back availability. Push and replace use native TanStack actions; host traversals without metadata have no known delta. Custom hosts must update their location snapshot synchronously for push and replace; traversal notifications can arrive asynchronously.
Cross-adapter navigation blockers are not supported because there is no shared blocker seam;
useBlockerstill works for navigation initiated through this page's own TanStack<Link>/router.navigate.Scoping needs two things: a page mount, saying which part of the URL belongs to the page, and a registered
AppHistoryApito project a history from. With either missing this adapter renderschildrenuntouched — no route tree is built, no router is created — and demands nothing of the surrounding app: no API provider, no framework context. That passthrough is what lets one component wrap itself in the adapter and still ship for both frontend systems: under the old frontend system there is no page mount and no app history, and the wrap has to be invisible rather than a crash. The same holds in a plugin's ownrender()unit tests.