Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix routing behavior when getStaticPaths params include hyphens #7694

Merged
merged 2 commits into from
Jul 18, 2023

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Jul 17, 2023

Changes

  • Our getStaticPaths implementation includes a keyed object
  • When we generate the RouteManifest, the generated route.pattern doesn't always match the generated routes due to hyphenization.
  • Rather than updating the route.pattern logic to account for hyphens, the correct fix is to update our getStaticPaths.keyed implementation to only store the final, generated pathname of the route. This removes any mismatched keys <=> data relationship. Hyphens are no longer relevant!
  • This is way more common than it might seem for anyone that has /route/[a]-[b]
  • Resolved Mismatch of dynamic route with multiple parameters when one contains hyphens #7265

Testing

Test added, existing tests should pass

Docs

Bug fix only

@changeset-bot
Copy link

changeset-bot bot commented Jul 17, 2023

🦋 Changeset detected

Latest commit: f65a173

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 17, 2023
@ematipico ematipico merged commit 06c2557 into main Jul 18, 2023
13 checks passed
@ematipico ematipico deleted the fix/7265--plt-492 branch July 18, 2023 09:36
@astrobot-houston astrobot-houston mentioned this pull request Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mismatch of dynamic route with multiple parameters when one contains hyphens
3 participants