Files
JJ KasperandGitHub 94a5bd6109 Normalize asPath for GS(S)P pages (#17081)
This normalizes the `asPath` for `getServerSideProps` and `getStaticProps` pages to ensure it matches the value that would show on the client instead of a) the output pathname when revalidating or generating a fallback or b) the `_next/data` URL on client transition. 

Fixes: https://github.com/vercel/next.js/issues/16542
2020-09-14 16:48:04 +00:00

9 lines
322 B
JavaScript

import { useRouter } from 'next/router'
export default function App({ Component, pageProps }) {
// we log the asPath during rendering to make sure the value is
// correct during the /_next/data request since they are kept in sync
console.log(`asPath: ${useRouter().asPath}`)
return <Component {...pageProps} />
}