rsnext/test/integration/revalidate-as-path/pages/index.js
JJ Kasper 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

21 lines
326 B
JavaScript

import { useRouter } from 'next/router'
export default function Index() {
const router = useRouter()
return (
<>
<p id="as-path">{router.asPath}</p>
<p id="index">index</p>
</>
)
}
export const getStaticProps = () => {
return {
props: {
hello: 'world',
},
revalidate: 1,
}
}