mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
* fix: Prevent page to scroll to top during data HMR * Add test for scroll position with gssp refreshing
28 lines
510 B
JavaScript
28 lines
510 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>
|
|
<div style={{ height: 1000, width: 50, background: 'cyan' }}></div>
|
|
<p id="scroll-target">bottom</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export const getStaticProps = async () => {
|
|
const count = 1
|
|
|
|
return {
|
|
props: {
|
|
count,
|
|
random: Math.random(),
|
|
},
|
|
}
|
|
}
|