Skip to content

fix(frontend): 404 navigation issues#5025

Merged
jog1t merged 1 commit into
mainfrom
05-06-fix_frontend_404_navigation_issues
May 15, 2026
Merged

fix(frontend): 404 navigation issues#5025
jog1t merged 1 commit into
mainfrom
05-06-fix_frontend_404_navigation_issues

Conversation

@jog1t
Copy link
Copy Markdown
Contributor

@jog1t jog1t commented May 11, 2026

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 11, 2026

🚅 Deployed to the rivet-pr-5025 environment in rivet-frontend

Service Status Web Updated (UTC)
kitchen-sink ❌ Build Failed (View Logs) Web May 15, 2026 at 7:42 pm
frontend-cloud 🕒 Building (View Logs) Web May 15, 2026 at 7:41 pm
ladle 🕒 Building (View Logs) Web May 15, 2026 at 7:41 pm
frontend-inspector 🕒 Building (View Logs) Web May 15, 2026 at 7:41 pm
website 😴 Sleeping (View Logs) Web May 11, 2026 at 6:49 pm
mcp-hub ✅ Success (View Logs) Web May 11, 2026 at 6:40 pm

@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5025 May 11, 2026 18:39 Destroyed
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 11, 2026

Code Review

Overview

This PR fixes two related 404/navigation crash scenarios in the frontend:

  1. orgs.$organization.tsx: Replaces throw notFound() with throw redirect({ to: "/" }) when the auth backend returns an error for an org slug lookup.
  2. ns.$namespace.tsx: Adds handling for the engine's 400 + { group: "namespace", code: "not_found" } response as equivalent to a true 404 (redirecting back to the project picker), and adds a missing errorComponent: RouteError to the route definition.

The root cause (TanStack Router leaving descendant matches stuck in pending when notFound() is thrown from a parent layout's beforeLoad) is well-diagnosed and the comment explains it clearly.


Issues and Suggestions

1. Org error redirect is too broad (potential regression)

In orgs.$organization.tsx, the check redirects to / for any value in org.error, not just org-not-found:

if (org.error) {
  throw redirect({ to: "/" });
}

A network failure, a 500 from the auth backend, or a rate-limit response would all silently drop the user to the root with no feedback. The original notFound() was narrower. Consider guarding this more tightly -- only redirect when the error is clearly a not-found or access-denied response, and re-throw for other error types so the error boundary can surface them.

2. Inline type cast in namespace route should use or extend the existing helper

The isRivetApiError helper in @/lib/errors already normalises API error shape checks. The PR introduces a parallel inline cast that diverges from that pattern. This would be cleaner extracted into errors.ts as a small dedicated helper (e.g. isNamespaceNotFound), consistent with how isAuthError already does body-narrowing in the same file.

3. errorComponent: RouteError -- good addition, minor gap in RouteError

Adding errorComponent: RouteError to the namespace route is a solid defensive improvement. Note that RouteError currently only shows a specialised message for statusCode === 404; a 400 + namespace.not_found error that slips through would display the generic "An unexpected error occurred" text. Since the PR's redirect intercepts those cases before RouteError renders this is not a live bug, but worth noting if redirect logic changes.


Minor Notes

  • The PR description checklist is entirely unchecked -- worth filling that in.
  • The comment added in orgs.$organization.tsx is clear and well-written.
  • Removing the unused notFound and isRivetApiError imports is correct.

Summary

The fix addresses a real crash correctly. The main concern is the broad redirect on any org.error in orgs.$organization.tsx -- this could silently drop users to root on transient network failures or server errors with no diagnostic. The inline type-cast in the namespace route is functional but diverges from the existing isRivetApiError pattern and would be cleaner as a shared helper. Everything else looks good.

@jog1t jog1t force-pushed the 05-05-fix_frontend_ns_aware_navigation branch from f2d1963 to ded0afc Compare May 11, 2026 18:49
@jog1t jog1t force-pushed the 05-06-fix_frontend_404_navigation_issues branch from 21070c2 to 9a22de6 Compare May 11, 2026 18:49
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5025 May 11, 2026 18:49 Destroyed
@jog1t jog1t force-pushed the 05-05-fix_frontend_ns_aware_navigation branch from ded0afc to aa332cf Compare May 15, 2026 19:30
@jog1t jog1t force-pushed the 05-06-fix_frontend_404_navigation_issues branch from 9a22de6 to 1b3211e Compare May 15, 2026 19:30
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5025 May 15, 2026 19:30 Destroyed
@jog1t jog1t mentioned this pull request May 15, 2026
11 tasks
Copy link
Copy Markdown
Contributor Author

jog1t commented May 15, 2026

Merge activity

  • May 15, 7:36 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 15, 7:42 PM UTC: Graphite rebased this pull request as part of a merge.
  • May 15, 7:42 PM UTC: @jog1t merged this pull request with Graphite.

@jog1t jog1t changed the base branch from 05-05-fix_frontend_ns_aware_navigation to graphite-base/5025 May 15, 2026 19:39
@jog1t jog1t changed the base branch from graphite-base/5025 to main May 15, 2026 19:40
@jog1t jog1t force-pushed the 05-06-fix_frontend_404_navigation_issues branch from 1b3211e to e7bf9f7 Compare May 15, 2026 19:41
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5025 May 15, 2026 19:41 Destroyed
@jog1t jog1t merged commit f8ea94d into main May 15, 2026
7 of 14 checks passed
@jog1t jog1t deleted the 05-06-fix_frontend_404_navigation_issues branch May 15, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant