Skip to content

Commit

Permalink
fix(app): fix ODD current run redirect whitescreen (#15753)
Browse files Browse the repository at this point in the history
wraps the ODD current run redirect Route in a Routes component to fix
the whitescreen error "A <Route> is only ever to be used as the child of
<Routes> element, never rendered directly. Please wrap your <Route> in a
<Routes>." Moves the TopLevelRedirects component inside of the
ErrorBoundary to avoid whitescreens (though reload would still trigger
the error boundary in this case)
  • Loading branch information
brenthagen authored Jul 23, 2024
1 parent 7fd60af commit 9319ae4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/App/OnDeviceDisplayApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ export const OnDeviceDisplayApp = (): JSX.Element => {
</>
)}
</Box>
<TopLevelRedirects />
</ErrorBoundary>
<TopLevelRedirects />
</OnDeviceLocalizationProvider>
</InitialLoadingScreen>
</ApiHostProvider>
Expand Down Expand Up @@ -275,7 +275,9 @@ export function OnDeviceDisplayAppRoutes(): JSX.Element {
function TopLevelRedirects(): JSX.Element | null {
const currentRunRoute = useCurrentRunRoute()
return currentRunRoute != null ? (
<Route element={<Navigate to={currentRunRoute} />} />
<Routes>
<Route path="*" element={<Navigate to={currentRunRoute} />} />
</Routes>
) : null
}

Expand Down

0 comments on commit 9319ae4

Please sign in to comment.