Skip to content

Blank screen flash on client-side redirects #1123

@david-crespo

Description

@david-crespo

console/app/routes.tsx

Lines 74 to 79 in bc046e7

{/* These are done here instead of nested so we don't flash a layout on 404s */}
<Route path="/orgs/:orgName" element={<Navigate to="projects" replace />} />
<Route
path="/orgs/:orgName/projects/:projectName"
element={<Navigate to="instances" replace />}
/>

These redirects cause us nothing but trouble. I moved them out from inside the layouts so that on a 404, we wouldn't briefly flash a layout and then go to 404. Unfortunately that means that we are flashing a blank screen instead on all navigation through the redirects, most notably navigation that actually goes somewhere! This is because we don't trigger the loader until we've rendered the route that itself renders the redirect. The simplest way to fix this is to call the loader for the target page on the redirecting <Route>.

I don't think I noticed this initially because the mock API server is almost instantaneous, whereas real Nexus is not quite that. The dev server needs an artficial delay.

2022-08-23-blank-flash

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions