File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 55 Navigate ,
66 Outlet ,
77 redirect ,
8+ useRouter ,
89 useRouterState ,
910} from "@tanstack/react-router" ;
1011import { lazy , Suspense , useCallback } from "react" ;
@@ -32,6 +33,7 @@ interface MyRouterContext {
3233}
3334
3435function RootErrorComponent ( { error, reset } : ErrorComponentProps ) {
36+ const router = useRouter ( ) ;
3537 const serverError = categorizeError (
3638 error ,
3739 "Failed to initialize application" ,
@@ -42,7 +44,9 @@ function RootErrorComponent({ error, reset }: ErrorComponentProps) {
4244 uiSettings . reset ( ) ;
4345 // Reset the router error boundary to trigger re-render
4446 reset ( ) ;
45- } , [ reset ] ) ;
47+ // Invalidate the router to force loaders to re-run
48+ void router . invalidate ( ) ;
49+ } , [ reset , router ] ) ;
4650
4751 return < ServerErrorDisplay error = { serverError } onRetry = { handleRetry } /> ;
4852}
You can’t perform that action at this time.
0 commit comments