@@ -377,22 +377,22 @@ async function contextualize(
377377 matches,
378378 routeId : route . id ,
379379 }
380- let context = parentContext
380+ let context : typeof parentContext
381381 try {
382- let routeContext = match . _ctx
383- if ( ! routeContext && route . options . context ) {
384- routeContext = match . _ctx =
385- route . options . context ( {
386- ...common ,
387- deps : match . loaderDeps ,
388- context : parentContext ,
389- } satisfies RouteContextOptions < any , any , any , any , any > ) || { }
390- }
391- context = {
382+ // Reuse the route's cached contribution while rebuilding its inheritance.
383+ const routeContext =
384+ match . _ctx ||
385+ ( route . options . context &&
386+ ( match . _ctx =
387+ route . options . context ( {
388+ ...common ,
389+ deps : match . loaderDeps ,
390+ context : parentContext ,
391+ } satisfies RouteContextOptions < any , any , any , any , any > ) || { } ) )
392+ match . context = context = {
392393 ...parentContext ,
393394 ...routeContext ,
394395 }
395- match . context = context
396396 } catch ( cause ) {
397397 match . context = parentContext
398398 releaseFlight ( router , match )
@@ -2240,7 +2240,6 @@ export async function hydrate(router: AnyRouter): Promise<void> {
22402240 let pendingBoundary : number | undefined
22412241 let verifiedAssetEnd = 0
22422242 const retryFrom = ( index : number ) => {
2243- pendingBoundary = Math . min ( pendingBoundary ?? index , index )
22442243 // The failing route's identity is still verified, but no descendant is.
22452244 verifiedAssetEnd = Math . min ( verifiedAssetEnd , index + 1 )
22462245 const removed = committed . splice ( index )
@@ -2420,6 +2419,8 @@ export async function hydrate(router: AnyRouter): Promise<void> {
24202419 match . status !== 'notFound' &&
24212420 ! match . _notFound
24222421 ) {
2422+ // Never present transported success without reconstructed context.
2423+ pendingBoundary = Math . min ( pendingBoundary ?? index , index )
24232424 retryFrom ( index )
24242425 break
24252426 }
0 commit comments