-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(routing): decode pathname early, don't decode params
#12079
Conversation
🦋 Changeset detectedLatest commit: 53ecdf5 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 |
params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a major
changeset. A reviewer will merge this at the next release if approved.
params
params
6039117
to
3c9b5cc
Compare
params
params
Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Bjorn Lu <[email protected]>
Changes
Closes #8516
To partially fix the issue, we had to change some assumptions and expectations about how
params
are handled.params
aren't decoded anymore, which means that users need to decode the parameters if they need to. While this change might break some users code, it allows us to have better predictability for SSG and SSR.Changes:
RenderContext.pathname
is decoded early. Usually, browsers and runtimes encode the URLs when creating aRequest
object, which means that we need to decode them back, so they match the file system paths that we have inRouteData
.[page]/index.html
.URL
constructs. That was needed becauseURL
does encoding, which is what we want, because now when loading files like[page]/index.html
, it will be encoded to something that can't be mapped to the FS file.Testing
Added new tests.
Please let me know if there are more tests I need to add to prevent future regressions.
Docs
withastro/docs#9497