@@ -16,6 +16,7 @@ export const router = createBrowserRouter(
1616 loader = { RootRoute . loader }
1717 Component = { RootRoute . Component }
1818 ErrorBoundary = { RootRoute . ErrorBoundary }
19+ HydrateFallback = { EmptyComponent }
1920 >
2021 { /**
2122 * ----------------------------------------------------------------
@@ -101,9 +102,20 @@ export const router = createBrowserRouter(
101102 </ Route >
102103 < Route path = "*" Component = { Page404 . Component } />
103104 </ Route >
104- < Route path = { ROUTES . LOGIN } loader = { Login . loader } />
105- < Route path = { ROUTES . LOGIN_RESULT } loader = { LoginResult . loader } />
106- < Route path = { ROUTES . LOGOUT } loader = { Logout . loader } action = { Logout . action } />
105+ < Route path = { ROUTES . LOGIN } loader = { Login . loader } Component = { EmptyComponent } HydrateFallback = { EmptyComponent } />
106+ < Route
107+ path = { ROUTES . LOGIN_RESULT }
108+ loader = { LoginResult . loader }
109+ Component = { EmptyComponent }
110+ HydrateFallback = { EmptyComponent }
111+ />
112+ < Route
113+ path = { ROUTES . LOGOUT }
114+ loader = { Logout . loader }
115+ action = { Logout . action }
116+ Component = { EmptyComponent }
117+ HydrateFallback = { EmptyComponent }
118+ />
107119 </ >
108120 ) ,
109121 { }
@@ -118,3 +130,14 @@ function dontRevalidateDialogs({ currentUrl, nextUrl }: ShouldRevalidateFunction
118130 }
119131 return true ;
120132}
133+
134+ // Because our `index.html` starts with a loading state, which we remove when
135+ // the app loads, we're fine rendering an empty component in various places.
136+ // This is an explicit way to say what's implicitly happening.
137+ // Otherwise, if we don't include thise, we get a bunch of console.warn()
138+ // messages like "No HydrateFallback provided" or
139+ // "Matched leaf route at location ... does not have an element..." which
140+ // blog up sentry.
141+ function EmptyComponent ( ) {
142+ return null ;
143+ }
0 commit comments