Repository navigation
fix(web): hide the shell until the first navigation resolves - #439
Merged
Merged
Conversation
The app mounts before the router guard has resolved /auth/me. Until the first navigation lands, the route is the start location, whose empty meta made showShell true: a signed-out reload drew the sidebar and header (admin-only areas marked locked) before the redirect to /login, and an administrator briefly saw the member view. The shell now waits for a matched route.
Coverage
Go by area
Web by area (lines)
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reloading a page while signed out showed the sidebar and header (Bundles "Requires administrator", Settings "Instance settings are managed by administrators", search) for as long as
/auth/metook, then switched to the login page. A signed-in administrator saw the same shell briefly in the member view.Cause.
main.tsmounts the app before the first navigation resolves, on purpose, so the session probe and page chunks load in parallel. Until the guard settles, the route is vue-router's start location: it matches nothing and has emptymeta, soshowShell(meta.layout !== 'blank') was true. Only<main>waited forsession.ready.Fix.
showShellalso needsroute.matched.length > 0, i.e. a resolved first navigation, by which time the guard has picked the user or redirected to/login.Verification
/auth/meby 1.5 s, DOM recorded with a MutationObserver:web/src/__tests__/App.test.tsholds the first navigation in a guard. It checks that the shell stays hidden while pending, never appears on a redirect to/login, and appears once a page is reached. It fails on the old code.bun run typecheckpasses;bun testpasses 2424 tests.