89ca0d10d4
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: https://github.com/vercel/next.js/discussions/14536 x-ref: https://github.com/vercel/next.js/discussions/9081#discussioncomment-31160 Closes: https://github.com/vercel/next.js/issues/14668
12 lines
278 B
JavaScript
12 lines
278 B
JavaScript
export default ({ lang }) => <p id="about">About: {lang}</p>
|
|
|
|
export const getStaticProps = ({ params: { lang } }) => ({
|
|
props: {
|
|
lang,
|
|
},
|
|
})
|
|
|
|
export const getStaticPaths = () => ({
|
|
paths: ['en', 'es', 'fr', 'de'].map((p) => `/lang/${p}/about`),
|
|
fallback: false,
|
|
})
|