Repository navigation
fix(pages): report page route clashes and match encoded page paths - #545
Merged
Merged
Conversation
- scanPages throws one error listing every route or page id that more than one page file resolves to (about.tsx + about/index.tsx, .tsx/.vue twins, the same page in two route groups, index.tsx + index/index.tsx). These had no stable winner: the server and the client could each pick a different file. Dynamic pages that match the same URLs ([id] and [slug]) only warn, once, since the first one always wins today. - The checks are skipped when another framework owns pages/ (Nuxt nests users.vue and users/index.vue). - A page in a folder named layout (layout/index.tsx) no longer loads the layout beside it: only then is that layout keyed "_layout" in the manifest. Nothing changes for apps without the clash. - Client navigation decodes the path the way the server (Hono) does before matching, so pages such as café.tsx or "a b.tsx" match on the client. The generated matchRoute and matchAdminRoute take that path. - void dev logs a page scan error and keeps the last good route table instead of exiting, and leaves the log to the adapter pages plugin when it reports the same error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-pages-route-clashes-void-cloud.voidzero-docs.workers.dev (commit bad5e80)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Follow-up to #534. Fixes page routing bugs that were already on main.
What was broken
about.tsx+about/index.tsx,x.tsx+x.vue,(a)/team.tsx+(b)/team.tsxIdentifier '_pload_about' has already been declared.index.tsx+index/index.tsxindex, so one route rendered the other page.layout/index.tsxnext tolayout.tsx/layoutrendered the layout as the page.café.tsx,a b.tsx/caf%C3%A9with the raw pattern.void devrunsWhat changes
Example error:
Notes:
matchRoutenow takes a decoded pathname. The engine andmatchAdminRoutefollow that.Tests
pages-scan.test.ts: the route clash error (exact text), the page id clash, the warning printed once across rescans, and no false positive for/users/[id]/editnext to/users/[userId]/postsor forlayout.tsx+layout/index.tsx.scan.test.ts: a Void app withusers.vue+users/index.vuethrows, and a Nuxt app does not.pages-manifest.test.ts: the layout folder case. Encoded paths are checked against a real Hono app for 19 URLs (%C3%A9,%c3%a9,%20,%25,%2525,%2F,%zz, over-encoded ASCII, query/hash), with and without a root[slug].plugin-routing.test.ts: movingabout.tsxtoabout/index.tsxin dev logs once, keeps the old table, and recovers on unlink. Nothing is logged when an adapter pages plugin is present.Not in this PR (already on main)
routes/has the same silent first-file-wins clash..dev/.prodpairs are intended there, so it needs its own rule.a-b.tsxanda_b.tsx, each with a.server.ts, both become_pload_a_b(dev SyntaxError).@void/edgematchSegmentPattern).[...].tsxmatches the bare/fileson the server but not on the client.🤖 Generated with Claude Code