Slug-form project routes degraded: add-option nav + [projectId] canonical redirect drops action suffixes

Seen in 1 project by 1 person

About

Follow-up from the add-option-scene work (commit 2e0a5c57). The owner-pivoted canonical /u and /g options/new routes now render AddOptionScene in place (was 404). But a deeper, pre-existing canonical-routing issue remains, confirmed with a REAL UI login (not just injected-cookie tests):

Symptoms (authed, dev, slug-href-probe owned by [email protected]):

  • /app/projects/<slug> (bare) -> correctly 307s to /app/projects/u/<handle>/<slug>. Redirect works for the no-suffix case.
  • /app/projects/<slug>/options/new -> does NOT redirect; stays on the slug URL and renders Next not-found (no AddOptionScene). The [projectId] layout's redirect(canonicalBase + suffix) appears to drop/ignore the action suffix for these deeper routes (suspect x-pathname not set for the nested route, or a Next 15 layout-redirect quirk for chained/suffix redirects).
  • Even on the canonical /u scene, the +Add button rendering is inconsistent (present in one run, absent in another) -> scene rendering flakiness on the (open) catch-all.
  • Net: a user whose project link falls back to the slug form (rail uses canonical_path ?? /app/projects/<slug>) gets a broken +Add -> options/new flow.

Also affects /import and /settings slug forms (same redirect path). NOT specific to options/new.

Notes:

  • The legacy-redirects integration test (tests/legacy-project-url-redirects.integration.test.ts) authenticates with an OUTDATED cookie (sb-access-token=<token>); current auth is @supabase/ssr (sb-<host>-auth-token base64). With the old cookie the app now 307s to /login, so that test no longer exercises the authed redirect — update it to the current cookie format and add an options/new / settings case that follows the redirect to assert the destination renders (not just the Location header).

Recommended approach: focused debug of the [projectId] layout redirect with a real-browser repro — verify x-pathname for nested routes, and decide whether action sub-routes (options/new, import, settings) should redirect to canonical+suffix or be rendered in place (like options/<id>/edit already is) to avoid the chained/suffix redirect. Likely the cleanest fix is to render those action scenes in place at the canonical route AND ensure the [projectId] layout preserves the suffix (or renders in place for action suffixes).

Verified DONE in 2e0a5c57: direct GET of /app/projects/u/<handle>/<slug>/options/new and /g/<group>/.../options/new renders AddOptionScene (was 404); AddOptionScene falls back to ProjectContext for currency + default definition.

Links

No links shared yet.

Listed in

Bookmarked in

Not in any public bookmark categories yet.