Fix /teams/team-ben by keeping the /teams wildcard on the [slug] page - #20057
Open
benben wants to merge 2 commits into
Open
Fix /teams/team-ben by keeping the /teams wildcard on the [slug] page#20057benben wants to merge 2 commits into
benben wants to merge 2 commits into
Conversation
onCreatePage gave the /teams/* match path to every page under /teams/, so the static team-ben page and the [slug] page both claimed the same wildcard. The [slug] page comes first in match-paths.json, so it won the tie for every /teams URL. The browser replaced the server-rendered team-ben page with [slug], which looked up a team with the slug "team-ben", found none, and showed an error. Give the wildcard to the [slug] page only. Gatsby then adds an exact match path for each static page under /teams/, which outranks the wildcard. Generated-By: PostHog Desktop Task-Id: 7a61ba1d-a58f-4f48-8af1-a64ceea893c2
Contributor
Deploy preview
|
benben
requested review from
bendbradley,
benjackwhite,
bs1180 and
darkopia
September 10, 2026 07:28
benben
marked this pull request as ready for review
September 10, 2026 07:28
benben
enabled auto-merge (squash)
September 10, 2026 07:29
Contributor
Bundle reportTotal JS (gzip)8.86 MiB (+0.0 KiB / +0.0%) Eager graph (modules shipped in each entrypoint's initial chunks)
Largest modules in the
|
| Module | Size |
|---|---|
./src/data/mcp-tools.json |
1119.8 KiB |
css ./node_modules/.pnpm/css-loader@5.2.7_webpack@5.101.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/postcss-loader@4.3.0_postcss@8.5.6_webpack@5.101.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css |
761.0 KiB |
./src/components/Stickers/Stickers.tsx |
696.4 KiB |
./node_modules/.pnpm/@radix-ui+react-icons@1.3.2_react@18.3.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js |
481.4 KiB |
./node_modules/.pnpm/@posthog+brand@0.8.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/x-ray.mjs |
480.8 KiB |
./node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.js + 29 modules |
395.1 KiB |
./node_modules/.pnpm/@posthog+brand@0.8.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/im-the-driver.mjs |
385.7 KiB |
./src/hooks/useCustomers.tsx + 55 modules |
370.0 KiB |
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
354.8 KiB |
./node_modules/.pnpm/react-markdown@8.0.7_@types+react@16.14.66_react@18.3.1/node_modules/react-markdown/lib/react-markdown.js + 88 modules |
351.4 KiB |
./src/components/ProductComparisonTable/index.tsx + 126 modules |
302.5 KiB |
./node_modules/.pnpm/cloudinary-core@2.14.0_lodash@4.17.21/node_modules/cloudinary-core/cloudinary-core.js |
281.9 KiB |
./node_modules/.pnpm/@posthog+brand@0.8.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/doll-house.mjs |
281.7 KiB |
./node_modules/.pnpm/@posthog+brand@0.8.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/director.mjs |
275.6 KiB |
./src/components/SearchUI/index.tsx + 87 modules |
273.7 KiB |
Eager-graph budgets are report-only until a baseline is established. Sizes are gzip of public/**/*.js; eager size is webpack module source bytes for the modules actually shipped in the entrypoint's initial chunks (post-tree-shake).
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.
Changes
/teams/team-benserved the correct page, then replaced it with an error a moment later.onCreatePageingatsby-node.tsgave the/teams/*match path to every page under/teams/, so the staticteam-benpage and the client-only[slug]page both claimed the same wildcard.[slug]comes first inmatch-paths.json, and @gatsbyjs/reach-router breaks a tie in scores by array order, so[slug]won every/teamsURL. On hydration the browser threw away the server-rendered Ben page, loaded[slug], looked up a team with the slugteam-ben, found none, and showed the error.Why: the page is unreachable, and any future static page under
/teams/would break the same way.The fix gives the wildcard to the
[slug]page only. Gatsby then adds an exact match path for each static page under/teams/(seegetMatchPathsinrequires-writer), and an exact path outranks a splat, so the static page wins. This is how/teams,/teams/new, and/community/profiles/mealready work. It also removes the need for the/teams/newexception, so that exception is gone.Evidence from the live bundle, before the fix:
No visual change: the Ben page markup is untouched, and the server-rendered HTML of the broken page already shows it in full. Please confirm on the preview build that
/teams/team-benstays on screen and that other team pages still route.I could not install dependencies in my environment, so
pnpm startand a production build did not run here.prettierreports no change to the diff.Checklist
vercel.json(no page moved)Created with PostHog from a Slack thread