Repository navigation
fix(jobs): stop a protected navigator shadowing the public /jobs listing - #767
Merged
Merged
Conversation
#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]>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#760 moved the jobs listing to
(public)and deleted theindexscreen from(protected)/jobs/_layout.tsx, but left the layout file. A_layout.tsxmakesits directory a navigator that claims the directory's own path, so two screens
claimed
"jobs"— asked of expo-router's own resolver: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
/jobsreturned 200 with no title, no description, no canonical andno JSON-LD, then showed the marketing landing page. The server route was built
and deployed the whole time (
λ Bundled … (public)/jobs/index.tsx), which iswhy it looked fine from the build log.
The chrome moves one level down —
saved/,applications/,my-listings/andview/each mount the shared JobsSectionLayout — so thejobssegment has nonavigator and the public listing is the only claim on
"jobs". Every child URLis unchanged; the resolver confirms
jobs/saved,jobs/applications,jobs/applications/:applicationId,jobs/my-listingsandjobs/view/:idallstill resolve, and those screens keep their drawer and ErrorBoundary.
Verified rather than assumed:
curl localhost/jobsnow returns the title, description and canonical thatproduction returns empty.
location.pathnamestays/jobsafter hydration instead of rewriting./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 toit; 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