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
[9.5.4-canary.18] Different router.asPath between server and client. #17113
Comments
This makes sure we have the correct `asPath` value to prevent breaking hydration for `getServerSideProps` pages and doesn't re-use the `resolvedUrl` value for the `asPath` and instead creates a separate `resolvedAsPath` value that only removes the `_next/data` prefix from the path. Additional tests have been added in the `getServerSideProps` suite to ensure correct `asPath` with rewrites. Fixes: #17113
Hi, this should be fixed in v9.5.4-canary.20 of Next.js, please upgrade and give it a try! |
@ijjk |
@nghiepit which part isn't resolved on that codesandbox link? It looks like the asPath is the expected value when visiting /my-post. We have also added these cases to our test suite which are passing. |
In my local project and export codesanbox.example.zip both are the same problem. |
@nghiepit I took another look at your reproduction and your issue doesn't appear to be related to the GS(S)P |
This makes sure we have the correct `asPath` value to prevent breaking hydration for `getServerSideProps` pages and doesn't re-use the `resolvedUrl` value for the `asPath` and instead creates a separate `resolvedAsPath` value that only removes the `_next/data` prefix from the path. Additional tests have been added in the `getServerSideProps` suite to ensure correct `asPath` with rewrites. Fixes: vercel#17113
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
From
9.5.4-canary.18
router.asPath
in the sever-side return incorrect value.Describe the bug
To Reproduce
https://codesandbox.io/s/sharp-cannon-kcsio?file=/pages/post.js
Directly access
/my-post
urlExpected behavior
The
router.asPath
always return/my-post
.Additional context
#17082
The text was updated successfully, but these errors were encountered: