fix(editions): move redirect to beforeLoad#130
Conversation
Redirects festivals with exactly one edition before EditionSelection renders, eliminating the "Redirecting to current edition..." flash. Closes #84
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR moves the single-edition auto-redirect out of the EditionSelection React component and into the TanStack Router route beforeLoad, preventing the component from rendering (and briefly showing a “Redirecting…” state) when the redirect should occur.
Changes:
- Added a
beforeLoadhook on/festivals/$festivalSlug/to prefetch the festival + editions andthrow redirect(...)when exactly one edition exists. - Removed the
useEffect-based navigation and the “Redirecting to current edition...” render branch fromEditionSelection. - Cleaned up unused imports (
useNavigate,useEffect) after removing the component-level redirect.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/routes/festivals/$festivalSlug/index.tsx |
Performs the single-edition redirect in beforeLoad after fetching festival + editions via the query client. |
src/pages/EditionSelection.tsx |
Removes component-driven redirect logic so the page only renders list/empty/loading states. |
Moves the single-edition auto-redirect from a useEffect in EditionSelection into the route's beforeLoad, so it never flashes before redirecting.
Festivals with exactly one edition now redirect with no visible "Redirecting..." state.
Verification
Closes #84
Generated by Claude Code