Next.js 16.2.4 - Bug When Navigating Back from 404 in Development
Unanswered
Griffon Fauve de Bretagne posted this in #help-forum
Griffon Fauve de BretagneOP
Versions:
- Next.js: 16.2.4
- React: 19.2.4
Context:
Previously I was using Next.js 15 in my main project and everything worked fine. I never had this problem.
I created a brand new project from scratch with Next.js 16 to test and replicate the error in isolation. The code is as basic as possible: a counter with a button that increments the value.
Code:
https://github.com/Dev-Asfix/nextjs-404-back-bug.git
Steps to Replicate:
1. Run
2. Navigate to
3. Navigate to a non-existent route, e.g.,
4. See the Next.js 404 page
5. Press the browser's "back" button
6. Return to
What I've Already Verified:
- If I manually reload the page (F5), everything starts working again
- If I run
- The problem ONLY occurs in development with
Question:
Is this a bug in Next.js 16 in development mode? Or is there something that changed in hydration that now requires special handling when navigating back from a 404?
- Next.js: 16.2.4
- React: 19.2.4
Context:
Previously I was using Next.js 15 in my main project and everything worked fine. I never had this problem.
I created a brand new project from scratch with Next.js 16 to test and replicate the error in isolation. The code is as basic as possible: a counter with a button that increments the value.
Code:
https://github.com/Dev-Asfix/nextjs-404-back-bug.git
Steps to Replicate:
1. Run
npm run dev2. Navigate to
/debug - the counter works, buttons respond3. Navigate to a non-existent route, e.g.,
/debug/ruta-falsa4. See the Next.js 404 page
5. Press the browser's "back" button
6. Return to
/debug but the counter DOES NOT work. Buttons don't respond. Only static HTML is visible.What I've Already Verified:
- If I manually reload the page (F5), everything starts working again
- If I run
npm run build and then npm start, the problem does NOT occur. It works perfectly in production- The problem ONLY occurs in development with
npm run devQuestion:
Is this a bug in Next.js 16 in development mode? Or is there something that changed in hydration that now requires special handling when navigating back from a 404?