mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This PR fixes #41064. In some particular cases, while using a middleware and shallow routing the navigation get stucks and stop refreshing the page. After futher investigation it seems that a line of code was added that causes the router pathname to be incorrect and then making Next believe it's the same page that is loading. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/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` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: JJ Kasper <[email protected]>
26 lines
468 B
JavaScript
26 lines
468 B
JavaScript
import Link from 'next/link'
|
|
import React from 'react'
|
|
|
|
const Page = () => {
|
|
return (
|
|
<>
|
|
<h1>Content for page 2</h1>
|
|
<Link
|
|
data-next-shallow-replace
|
|
replace
|
|
shallow
|
|
href={{ query: { params: 'testParams' } }}
|
|
>
|
|
Shallow replace
|
|
</Link>
|
|
<div>
|
|
<button data-go-back onClick={() => window.history.back()}>
|
|
Go Back
|
|
</button>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Page
|