-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Closed as not planned
Closed as not planned
Copy link
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.lockedstaleThe issue has not seen recent activity.The issue has not seen recent activity.
Description
Link to the code that reproduces this issue or a replay of the bug
https://github.com/IrynaD25/my-app
To Reproduce
- npx create-next-app@latest
- use default settings
- create
not-found.tsxwith a link to the home page in theappfolder:
import NextLink from 'next/link';
const NotFound = () => (
<div>
<h2>404 PAGE</h2>
<NextLink href="/">
GO HOME
</NextLink>
</div>
);
export default NotFound;
- call
headersfunction inapp/page.tsxin order to switch to dynamic rendering
import Image from 'next/image'
import { headers } from 'next/headers';
import styles from './page.module.css'
export default function Home() {
const headersInstance = headers()
return (
<main className={styles.main}>
// other code
</main>
)
}
- run
next build - run
next start - navigate to a page that does not exist (e.g. http://localhost:3000/fewfw)
- Click the 'GO HOME' link
- Observe that the url changes, but the UI stays the same
Current vs. Expected behavior
When navigating from not-found to the home page, the url correctly changes to the home page, but the UI remains unchanged.
- This bug occurs when the home page is dynamically rendered
- This bug occurs only after running
next buildandnext start. There is no bug when runningnext dev. - When the
prefetchprop on theNextLinkcomponent in thenot foundpage is explicitly set to eithertrueorfalse, the redirection to the home page works, as expected, and the home page is displayed upon clicking the link.
Current Behaviour
After clicking next/link on the not found page, the url changes, but the UI isn't changed (the not found page is still displayed instead of the home page)
Screen.Recording.2023-09-08.at.14.20.00.mov
Expected Behaviour
Clicking next/link on the not found page should redirect to the home page and display its content.
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Thu Mar 9 20:08:59 PST 2023; root:xnu-8020.240.18.700.8~1/RELEASE_X86_64
Binaries:
Node: 16.18.0
npm: 8.19.2
Yarn: 1.22.10
pnpm: N/A
Relevant Packages:
next: 13.4.20-canary.21
eslint-config-next: 13.4.19
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
App Router
Additional context
This bug occurs both locally and after deploying the app.
Locally, this bug occurs only after running next build and next start. There is no bug when running next dev.
alexkrechik, JesseKoldewijn, budchirp, raftario, FluxCapacitor2 and 5 more
Metadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.lockedstaleThe issue has not seen recent activity.The issue has not seen recent activity.