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

fetchNextData does not support dynamic SSG routes with mismatching href and as #14668

Closed
ijjk opened this issue Jun 29, 2020 · 1 comment · Fixed by #14667
Closed

fetchNextData does not support dynamic SSG routes with mismatching href and as #14668

ijjk opened this issue Jun 29, 2020 · 1 comment · Fixed by #14667
Assignees
Milestone

Comments

@ijjk
Copy link
Member

ijjk commented Jun 29, 2020

Since fetchNextData doesn't use the same /_next/data building logic as prefetching when mismatching href and as values are provided for a dynamic SSG route the page data will be able to be prefetched but not loaded on client-transition.

@ijjk ijjk self-assigned this Jun 29, 2020
@Timer Timer added this to the 9.x.x milestone Jun 29, 2020
@kodiakhq kodiakhq bot closed this as completed in #14667 Jun 29, 2020
kodiakhq bot pushed a commit that referenced this issue Jun 29, 2020
This updates `fetchNextData` to re-use the `getDataHref` function from `page-loader` which has more verbose handling to ensure the correct `/_next/data` URL is built. Re-using this logic ensures the `/_next/data` URL can still be built even when a mismatching `href` and `as` value is provided to `next/link`.

This also fixes a case in `getDataHref` where optional values that weren't provided would fail to build the data href since the check requiring the param be present while interpolating the route values hasn't been updated to allow missing params for optional values.

An additional test case has been added to the prerender suite to ensure the `/_next/data` URL is built correctly when mismatching `href` and `as` values are provided

x-ref: #14536
x-ref: #9081 (reply in thread)
Closes: #14668
@Timer Timer modified the milestones: 9.x.x, iteration 4, iteration 3 Jun 29, 2020
rokinsky pushed a commit to rokinsky/next.js that referenced this issue Jul 11, 2020
This updates `fetchNextData` to re-use the `getDataHref` function from `page-loader` which has more verbose handling to ensure the correct `/_next/data` URL is built. Re-using this logic ensures the `/_next/data` URL can still be built even when a mismatching `href` and `as` value is provided to `next/link`.

This also fixes a case in `getDataHref` where optional values that weren't provided would fail to build the data href since the check requiring the param be present while interpolating the route values hasn't been updated to allow missing params for optional values.

An additional test case has been added to the prerender suite to ensure the `/_next/data` URL is built correctly when mismatching `href` and `as` values are provided

x-ref: vercel#14536
x-ref: vercel#9081 (reply in thread)
Closes: vercel#14668
@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants