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(rewrite): purge old data when rewriting #11207

Merged
merged 3 commits into from
Jun 11, 2024
Merged

Conversation

ematipico
Copy link
Member

Changes

Closes #11204

This PR fixes two issues:

  • Inside RenderContext, pathname is now updated during the rewriting. To correctly infer the correct pathname (RouteData.pathame sometimes is undefined, and RouteData.route ins't correct e.g. /some-slug/title VS /[slug]/title, and we need the former)
  • The tryRewrite now returns the new URL, since we had the logic here in all the pipelines
  • We recompute the AstroPartial object when rewriting because during rewriting, we were sending old information, such as params

Testing

Added two new test cases

Docs

N/A

Copy link

changeset-bot bot commented Jun 7, 2024

🦋 Changeset detected

Latest commit: 025a2ce

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 Jun 7, 2024
@ematipico ematipico requested review from matthewp and a team June 7, 2024 14:59
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Quick note on the changeset! 🙌

.changeset/fuzzy-eggs-kneel.md Outdated Show resolved Hide resolved
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

approving changset for docs!

@ematipico ematipico merged commit 7d9aac3 into main Jun 11, 2024
14 checks passed
@ematipico ematipico deleted the fix/rewrite-dynamic-rout branch June 11, 2024 11:59
@astrobot-houston astrobot-houston mentioned this pull request Jun 11, 2024
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.

Astro.rewrite not working with SSR dynamic routes
3 participants