3790099997
### Problem We've identified a bug within Next.js's pages router when utilizing the shallow routing API, specifically when invoking `router.push` with the `{ shallow: true }` option, like so: ```javascript router.push('/?counter=10', undefined, { shallow: true }); ``` Shallow routing is designed to update the URL without running data fetching methods such as getServerSideProps, getStaticProps, or getInitialProps. However, a side effect of this process is that it skips the clean-up of the cancelHandler. This leads to router error events being fired erroneously, causing confusion and potential stability issues, as the system behaves as if an error occurred when, in fact, none did. ### Solution This PR addresses the issue by modifying the shallow routing logic to also skip the creation of the cancelHandler. Given that shallow routing operations are synchronous and do not involve data fetching or other asynchronous tasks that might need to be canceled, the cancelHandler is unnecessary in this context. fixes #61772 --------- Co-authored-by: Shu Ding <g@shud.in> |
||
---|---|---|
.. | ||
create-next-app | ||
eslint-config-next | ||
eslint-plugin-next | ||
font | ||
next | ||
next-bundle-analyzer | ||
next-codemod | ||
next-env | ||
next-mdx | ||
next-plugin-storybook | ||
next-polyfill-module | ||
next-polyfill-nomodule | ||
next-swc | ||
react-refresh-utils | ||
third-parties |