@@ -81,7 +81,7 @@ const getNotFoundBoundaryIndex = (
8181 return undefined
8282 }
8383
84- const requestedRouteId = err . routeId ? String ( err . routeId ) : undefined
84+ const requestedRouteId = err . routeId
8585 const matchedRootIndex = inner . matches . findIndex (
8686 ( m ) => m . routeId === inner . router . routeTree . id ,
8787 )
@@ -890,7 +890,7 @@ export async function loadMatches(arg: {
890890 updateMatch : UpdateMatchFn
891891 sync ?: boolean
892892} ) : Promise < Array < MakeRouteMatch > > {
893- const inner : InnerLoadContext = Object . assign ( arg )
893+ const inner : InnerLoadContext = arg
894894 const matchPromises : Array < Promise < AnyRouteMatch > > = [ ]
895895
896896 // make sure the pending component is immediately rendered when hydrating a match that is not SSRed
@@ -941,7 +941,6 @@ export async function loadMatches(arg: {
941941 ? Math . min ( boundaryIndex + 1 , baseMaxIndexExclusive )
942942 : baseMaxIndexExclusive
943943
944- let firstRedirect : unknown
945944 let firstNotFound : NotFoundError | undefined
946945
947946 for ( let i = 0 ; i < maxIndexExclusive ; i ++ ) {
@@ -957,19 +956,15 @@ export async function loadMatches(arg: {
957956 if ( result . status !== 'rejected' ) continue
958957
959958 const reason = result . reason
960- if ( ! firstRedirect && isRedirect ( reason ) ) {
961- firstRedirect = reason
959+ if ( isRedirect ( reason ) ) {
960+ throw reason
962961 }
963962 if ( ! firstNotFound && isNotFound ( reason ) ) {
964963 firstNotFound = reason
965964 }
966965 }
967966 }
968967
969- if ( firstRedirect ) {
970- throw firstRedirect
971- }
972-
973968 const notFoundToThrow =
974969 firstNotFound ??
975970 ( beforeLoadNotFound && ! inner . preload ? beforeLoadNotFound : undefined )
@@ -1008,10 +1003,19 @@ export async function loadMatches(arg: {
10081003
10091004 notFoundToThrow . routeId = boundaryMatch . routeId
10101005
1006+ const boundaryIsRoot = boundaryMatch . routeId === inner . router . routeTree . id
1007+
10111008 inner . updateMatch ( boundaryMatch . id , ( prev ) => ( {
10121009 ...prev ,
1013- status : 'notFound' ,
1014- error : notFoundToThrow ,
1010+ ...( boundaryIsRoot
1011+ ? // For root boundary, use globalNotFound so the root component's
1012+ // shell still renders and <Outlet> handles the not-found display.
1013+ // Setting status:'notFound' on root would replace the entire shell,
1014+ // and in Solid/Vue the status update can be lost inside startTransition.
1015+ { globalNotFound : true }
1016+ : // For non-root boundaries, set status:'notFound' so MatchInner
1017+ // renders the notFoundComponent directly.
1018+ { status : 'notFound' as const , error : notFoundToThrow } ) ,
10151019 isFetching : false ,
10161020 } ) )
10171021
0 commit comments