Skip to content

fix(jobs): stop a protected navigator shadowing the public /jobs listing - #767

Merged
thinkclay merged 1 commit into
mainfrom
fix/756-jobs-route-resolution
Sep 15, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/756-jobs-route-resolution

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

#760 moved the jobs listing to (public) and deleted the index screen from
(protected)/jobs/_layout.tsx, but left the layout file. A _layout.tsx makes
its directory a navigator that claims the directory's own path, so two screens
claimed "jobs" — asked of expo-router's own resolver:

"jobs"        /(protected)/jobs        <- navigator, no index child
"jobs"        /(public)/jobs/index     <- the public listing
"jobs/:slug"  /(public)/jobs/[slug]

React Navigation matches the first, found a navigator with no screen for the
path, rendered nothing, and expo-router's history sync rewrote the URL. In
production /jobs returned 200 with no title, no description, no canonical and
no JSON-LD, then showed the marketing landing page. The server route was built
and deployed the whole time (λ Bundled … (public)/jobs/index.tsx), which is
why it looked fine from the build log.

The chrome moves one level down — saved/, applications/, my-listings/ and
view/ each mount the shared JobsSectionLayout — so the jobs segment has no
navigator and the public listing is the only claim on "jobs". Every child URL
is unchanged; the resolver confirms jobs/saved, jobs/applications,
jobs/applications/:applicationId, jobs/my-listings and jobs/view/:id all
still resolve, and those screens keep their drawer and ErrorBoundary.

Verified rather than assumed:

  • curl localhost/jobs now returns the title, description and canonical that
    production returns empty.
  • location.pathname stays /jobs after hydration instead of rewriting.
  • route-shadowing.test.ts fails on the shipped state, naming it exactly —
    /jobs ← navigator ./(protected)/jobs/_layout.tsx shadows ./(public)/jobs/index.tsx — and passes once the layout moves.

That test is the point. route-collisions.test.ts compares page files and skips
anything beginning with _, so a layout-versus-page collision was invisible to
it; sitemap-routes-are-public.test.ts only asks which group a file sits in. Both
guards read the filesystem. This one reads what expo-router actually resolves,
via its own getRoutes, so it cannot drift from the router the way a
re-implementation does. If those internals move, it fails loudly — it asserts
the tree is non-trivial first, so a broken import cannot make it vacuously
green.

Closes #766


🤖 Generated with Claude Code

#760 moved the jobs listing to `(public)` and deleted the `index` screen from
`(protected)/jobs/_layout.tsx`, but left the layout file. A `_layout.tsx` makes
its directory a navigator that claims the directory's own path, so two screens
claimed `"jobs"` — asked of expo-router's own resolver:

    "jobs"        /(protected)/jobs        <- navigator, no index child
    "jobs"        /(public)/jobs/index     <- the public listing
    "jobs/:slug"  /(public)/jobs/[slug]

React Navigation matches the first, found a navigator with no screen for the
path, rendered nothing, and expo-router's history sync rewrote the URL. In
production `/jobs` returned 200 with no title, no description, no canonical and
no JSON-LD, then showed the marketing landing page. The server route was built
and deployed the whole time (`λ Bundled … (public)/jobs/index.tsx`), which is
why it looked fine from the build log.

The chrome moves one level down — `saved/`, `applications/`, `my-listings/` and
`view/` each mount the shared JobsSectionLayout — so the `jobs` segment has no
navigator and the public listing is the only claim on `"jobs"`. Every child URL
is unchanged; the resolver confirms `jobs/saved`, `jobs/applications`,
`jobs/applications/:applicationId`, `jobs/my-listings` and `jobs/view/:id` all
still resolve, and those screens keep their drawer and ErrorBoundary.

Verified rather than assumed:

  * `curl localhost/jobs` now returns the title, description and canonical that
    production returns empty.
  * `location.pathname` stays `/jobs` after hydration instead of rewriting.
  * route-shadowing.test.ts fails on the shipped state, naming it exactly —
    `/jobs ← navigator ./(protected)/jobs/_layout.tsx shadows
    ./(public)/jobs/index.tsx` — and passes once the layout moves.

That test is the point. route-collisions.test.ts compares page files and skips
anything beginning with `_`, so a layout-versus-page collision was invisible to
it; sitemap-routes-are-public.test.ts only asks which group a file sits in. Both
guards read the filesystem. This one reads what expo-router actually resolves,
via its own getRoutes, so it cannot drift from the router the way a
re-implementation does. If those internals move, it fails loudly — it asserts
the tree is non-trivial first, so a broken import cannot make it vacuously
green.

Closes #766

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay merged commit 87926ba into main Sep 15, 2026
9 checks passed
@thinkclay
thinkclay deleted the fix/756-jobs-route-resolution branch September 15, 2026 01:30
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.

/jobs renders the marketing page: a protected navigator still claims the path the public listing now serves

1 participant