Router edges: pinned TanStack versions, pending and retrying error pages, zod search params #407
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amaurycoudr/chess-project#407
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
The front's TanStack Router setup follows the docs at its core (loaders prime Query, components read with
useSuspenseQuery, intent preloading withdefaultPreloadStaleTime: 0, automatic code splitting), but its edges lag behind:latest,@tanstack/router-pluginis declared twice, and the route generator's CLI config does not match the Vite plugin's, so a fresh install orgenerate-routescan change behaviour or rewrite the committed route tree. The live TanStack docs already describe APIs our lockfile does not have (queryClient.query(), Query 5.102).Source: the front audit,
docs/research/front-audit.md, sections 1 (points 2-4) and 2.1.Solution
User Stories
@tanstack/router-plugindeclared once, so that the version that runs is the one I read.generate-routesand the Vite build to write the same route tree, so that neither leaves a diff behind the other.Seams
AccountPageViewwith the auth harness, andMyGamesViewwith the games harness (front view tests). Covers 9-10: the existing search-parameter tests stay green unchanged, plus an unknown-value case each.generate-routeson a clean tree leavesrouteTree.gen.tsunchanged, and the gate is green on the pinned versions.apps/e2e(e2e). Covers 6-7 in a real browser: the first read behind a page is failed once with Playwright's request interception, the error is shown, and "Try again" shows the page.Implementation Decisions
latest, at least the versions in today's lockfile. Bumping Query past 5.102 is not part of this spec; when it happens,ensureQueryDatamoves toqueryClient.query()(ADR 0019 stays).tsr.config.jsoncarries the same generator options as the Vite plugin (target, quote style, semicolons), so the CLI's output matches.defaultPendingComponent, keeping the router's defaultpendingMs/pendingMinMsunless a test shows a reason to tune them. It lives inapp/, beside the existing router-wide error and not-found components.useQueryErrorResetBoundary) and callrouter.invalidate()from "Try again". The copy is the existing site error plus a new "Try again" message.validateSearchtakes a zod 4 schema directly (no adapter), with.catch()so an unknown value falls back. Under today's lint rule a route imports only a vertical's view or services, so the schemas are exported from the views that own the choices; they move into the route files once the rules spec allows it.tryChoiceOfgoes if nothing else uses it.Testing Decisions
router.test.tsx(router-level behaviour throughmountRouter),account-page.test.tsxandmy-games.test.tsx(search parameters),app-shell.test.tsx(French copy).sectionorresult; aresultgiven twice.Out of Scope
queryClient.query()migration.useBlocker(no use case today;useBlockeris experimental).Further Notes
docs/research/front-audit.mdon branchclaude/nestjs-best-practices-audit-716d79.mentioned in issue #411
marked this issue as related to #411
marked this issue as related to #412
mentioned in issue #412
mentioned in issue #413
marked this issue as related to #413
mentioned in merge request !533