mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
From https://github.com/vercel/next.js/pull/20628, when the page is rendered server-side, `Router`'s `isReady` field needs to be initially set to `true`. However, when `_app` has custom `getInitialProps`, it seems that it is not the case, even though the page is rendered on the server. This leads to a bug that `Router.isReady` is never set to `true`. This pull request fixes the problem by fixing the initial calculation logic of `isReady` of `Router`. ## Bug - [ ] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes
16 lines
292 B
JavaScript
16 lines
292 B
JavaScript
import { useRouter } from 'next/router'
|
|
|
|
export default function Page(props) {
|
|
// eslint-disable-next-line
|
|
const router = useRouter()
|
|
|
|
// console.log(router.isReady)
|
|
|
|
return (
|
|
<>
|
|
<p id="invalid">invalid page</p>
|
|
<p id="props">{JSON.stringify(props)}</p>
|
|
</>
|
|
)
|
|
}
|