[404] design the not-found page with an auth-aware shell - #174
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the TalkUp.AI-pr-174 environment in talk-up-ai
|
BhuvanArn
marked this pull request as ready for review
July 15, 2026 20:03
badarouzia
approved these changes
Jul 15, 2026
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.
What
The 404 page was an unstyled 13-line stub (
<p>Not found!</p>+ a "Go home" link). This gives it a designed page, shows the sidebar only when the visitor is authenticated, and offers a way out appropriate to their auth state./applicationsrouter.history.back())//loginAuthed users get Go back because a dead link hit from inside the app is best escaped backwards. Anonymous users get Log in instead — someone anonymous on a deep link is usually an expired session, and Go back would bounce them onto the same dead page.
Why the root had to change
__root.tsxpicked its shell from a hardcoded pathname allowlist. An unmatched URL (/zzz) is in neitherPUBLIC_SHELL_PATHSnorPUBLIC_NAV_PATHS, so it fell through to the app-shell branch — the sidebar rendered around the 404 for logged-out visitors. Styling the page alone could not fix this.The root now detects the not-found state from router match state (
status === 'notFound' || globalNotFound, verified against@tanstack/router-coreMatches.d.ts:49,72) and picks the shell itself. The new branch runs before the existing pathname checks; all three existing branches are untouched, so every currently-matching route behaves exactly as before.Auth is read via
useAuthStatus()(a real query), notuseAuth(): 404 routes fire no route guard, so the context reports logged-out even for a signed-in user on a hard reload, which would flash the wrong shell. While the query is in flight the anonymous variant renders — no spinner; anonymous is the common case and lands correct immediately, and authed users usually skip the tick (staleTime: 60s, warm from in-app navigation).main.tsx'sdefaultNotFoundComponentis now() => null: the root's branch renders<NotFoundPage />instead of<Outlet />, so the router's substitution path (Outlet.js:225) is never mounted. Exactly one 404 renders, always with its shell.Verified in a real browser
Not just tests — driven end-to-end against a live backend:
/, Log in →/login/applications, and Go back clicked from a dead URL returned to/notesTwo bugs only the browser caught, both fixed here:
<h1>—<Logo>already owns the page's h1; the heading is nowh2. The original test queried by name without a level, so it passed. It now asserts the level, plus a test that exactly one h1 exists.h-fullresolved to nothing against amin-h-screenparent, sojustify-centercentered inside 525px of an 875px viewport.Notes
text-body-m, nottext-body-md— the latter is undefined intailwind.css(only.text-body-mat :366) and silently renders at browser-default size.EmptyStatecurrently uses the broken class — pre-existing, out of scope, worth a follow-up.:root[data-view='organization'], blue → green) never reaches a 404: measureddata-viewasnullthere, becauseNavigationContext.tsx:104-108sets it from navigation state and removes it on unmount. The button is always the default blue.-not-found.tsxkeeps its-prefix).Test plan
npx vitest run src/routes/-not-found.spec.tsx src/routes/-__root.spec.tsx— 11/11 passnpm run lint:check— 0 warnings, 0 errors (web + server)npx tsc -b— exit 0prettier --checkon all changed files — clean🤖 Generated with Claude Code