Files
JJ KasperandGitHub 050936c040 test(fix: Prevent page to scroll to top during data HMR) (#35744)
* fix: Prevent page to scroll to top during data HMR

* Add test for scroll position with gssp refreshing
2022-03-30 11:20:50 -05:00

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(),
},
}
}