File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/react-router/lib/dom/ssr Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " react-router " : patch
3+ ---
4+
5+ Handle redirects from ` clientLoader.hydrate ` initial load executions
Original file line number Diff line number Diff line change @@ -428,14 +428,19 @@ async function singleFetchLoaderNavigationStrategy(
428428 await Promise . all ( routeDfds . map ( ( d ) => d . promise ) ) ;
429429
430430 // We can skip the server call:
431- // - On initial hydration - only clientLoaders can pass through via `clientLoader.hydrate`
431+ // - On initial hydration - only clientLoaders can pass through via
432+ // `clientLoader.hydrate`. We check the navigation state below as well
433+ // because if a clientLoader redirected we'll still be `initialized=false`
434+ // but we want to call loaders for the new location
432435 // - If there are no routes to fetch from the server
433436 //
434437 // One exception - if we are performing an HDR revalidation we have to call
435438 // the server in case a new loader has shown up that the manifest doesn't yet
436439 // know about
440+ let isInitialLoad =
441+ ! router . state . initialized && router . state . navigation . state === "idle" ;
437442 if (
438- ( ! router . state . initialized || routesParams . size === 0 ) &&
443+ ( isInitialLoad || routesParams . size === 0 ) &&
439444 ! window . __reactRouterHdrActive
440445 ) {
441446 singleFetchDfd . resolve ( { routes : { } } ) ;
You can’t perform that action at this time.
0 commit comments