Shadow Routes #3007
ericchernuka
started this conversation in
RFCs
Shadow Routes
#3007
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Shadow routes refer to routes that another application may own but still exist under the same domain. While migrating our application, we aim for a centralized source of truth for routing. This ensures that even if some routes exist in another app, our TanStack Router app can maintain typesafe routing. However, it's important to note that when navigating to these shadow routes, the router results in an entire document reload instead of just a client-side navigation.
Problem
It's common when building a new application to bridge the old and new apps to move routes incrementally. The router provides type safety around routes it manages. Still, links to the old application must be handled separately with "hacks" to trick the router into doing a full-page reload by treating the routes as external.
Proposal
Introducing a new route builder,
createShadowFileRoute,
limits the RouteOptions interface to a subset of features to enable type safety of external routed paths.Goals
reloadDocument
was added to all navigation concepts, which could underpin the behaviour when committing to the navigation route.API Design
Changes
proceed
logic before performing a shadow route navigationPreviously discussed designs
Route Splitting
Since these would be part of the route manifest, we do not see a reason they should be part of file-splitting behaviour, but a unique prefix may need to be used to skip it.
Unsupported features of Shadow Routes
beforeLoad
loader
from
supportConsiderations
.shadow.tsx
for easier identification and migration.Beta Was this translation helpful? Give feedback.
All reactions