Skip to content

fix(errors): correct param key in getStaticPaths error-doc examples (slug → id)#16976

Merged
ematipico merged 1 commit into
withastro:mainfrom
DucMinhNe:fix/getstaticpaths-example-param-key
Jun 5, 2026
Merged

fix(errors): correct param key in getStaticPaths error-doc examples (slug → id)#16976
ematipico merged 1 commit into
withastro:mainfrom
DucMinhNe:fix/getstaticpaths-example-param-key

Conversation

@DucMinhNe

Copy link
Copy Markdown
Contributor

Summary

Three JSDoc example blocks in errors-data.ts — for InvalidGetStaticPathParam, InvalidGetStaticPathsEntry, and InvalidGetStaticPathsReturn — open with the route file pages/blog/[id].astro but then return params keyed on slug:

{ params: { slug: "blog" } },
{ params: { slug: "about" } }

For a dynamic route [id].astro, getStaticPaths() must return params keyed on the segment name id. A slug key would itself trigger a routing error, so these examples — whose whole purpose is to teach correct getStaticPaths() usage — are internally inconsistent.

These JSDoc blocks also generate the public Error Reference pages, so the mismatch is user-facing (e.g. docs.astro.build/en/reference/errors/invalid-get-static-path-param/).

Change

Replace the slug param key with id in all six lines so each example matches its declared [id].astro route. This matches the neighboring blocks GetStaticPathsExpectedParams and GetStaticPathsInvalidRouteParam, which already use { params: { id: ... } } for an [id] route.

Docs/comment example only — no runtime code changes.

@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 735d286

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added pkg: astro Related to the core `astro` package (scope) docs pr labels Jun 5, 2026
@codspeed-hq

codspeed-hq Bot commented Jun 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing DucMinhNe:fix/getstaticpaths-example-param-key (735d286) with main (c610cda)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (c90ce97) during the generation of this report, so c610cda was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@ematipico ematipico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ematipico ematipico merged commit 12495be into withastro:main Jun 5, 2026
29 checks passed
matthewp pushed a commit that referenced this pull request Jun 8, 2026
* fix(errors): correct param key in getStaticPaths error-doc examples (slug → id) (#16976)

* fix(cloudflare): defer createApp/setGetEnv in fetch.ts to avoid circular import crash (#16956) (#16968)

* fix(fetch): sync request.url with forwarded headers in FetchState (#16947)

* fix(fetch): sync request.url with forwarded headers in FetchState (#16945)

* chore: improve tests and solution

---------

Co-authored-by: astrobot-houston <fred+astrobot@astro.build>

* chore: avoid an unwanted mdx major bump (#16977)

* chore(renovate): bump max memory (#16993)

---------

Co-authored-by: Minh Lê <115204145+DucMinhNe@users.noreply.github.com>
Co-authored-by: Houston (Bot) <108291165+astrobot-houston@users.noreply.github.com>
Co-authored-by: Emanuele Stoppa <estoppa@cloudflare.com>
Co-authored-by: astrobot-houston <fred+astrobot@astro.build>
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
florian-lefebvre added a commit that referenced this pull request Jun 8, 2026
Co-authored-by: astrobot-houston <fred+astrobot@astro.build>
Co-authored-by: Minh Lê <115204145+DucMinhNe@users.noreply.github.com>
Co-authored-by: Houston (Bot) <108291165+astrobot-houston@users.noreply.github.com>
Co-authored-by: Emanuele Stoppa <estoppa@cloudflare.com>
Co-authored-by: ocavue <ocavue@users.noreply.github.com>
fix(errors): correct param key in getStaticPaths error-doc examples (slug → id) (#16976)
fix(cloudflare): defer createApp/setGetEnv in fetch.ts to avoid circular import crash (#16956) (#16968)
fix(fetch): sync request.url with forwarded headers in FetchState (#16947)
fix(fetch): sync request.url with forwarded headers in FetchState (#16945)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants