mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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
9 lines
322 B
JavaScript
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} />
|
|
}
|