mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
* Update server-only changes HMR handling * Add failing tests for GS(S)P server only changes * update test * normalize backslashes * Update to xor the chunk hashes * remove test change * remove other test change
41 lines
741 B
JavaScript
41 lines
741 B
JavaScript
import { useRouter } from 'next/router'
|
|
|
|
export default function Gsp(props) {
|
|
if (useRouter().isFallback) {
|
|
return 'Loading...'
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<p id="change">change me</p>
|
|
<p id="props">{JSON.stringify(props)}</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export const getStaticProps = async ({ params }) => {
|
|
const count = 1
|
|
|
|
if (params.post === 'second') {
|
|
await new Promise((resolve) => setTimeout(resolve, 2000))
|
|
}
|
|
|
|
return {
|
|
props: {
|
|
count,
|
|
params,
|
|
random: Math.random(),
|
|
},
|
|
}
|
|
}
|
|
|
|
export const getStaticPaths = () => {
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const paths = 1
|
|
|
|
return {
|
|
paths: [{ params: { post: 'first' } }, { params: { post: 'second' } }],
|
|
fallback: true,
|
|
}
|
|
}
|