vercel / vercel/next.js

Changing search params on the same page does not reset the not found boundary

Open
#69,622 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Linking and Navigating
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/ali-idrizi/next-not-found-search-params-reproduction

To Reproduce

This is a very minimal reproduction. In the /about page if the q search param is "404", then notFound is called.

The layout has three buttons that call router.push, one to /, one to /about and the last to /about?q=404. Clicking the last button correctly shows the not found page. However, afterwards clicking /about no longer resets it. The 404 page goes away only after navigating to an entirely different page, or hard reloading.

In the network tab, I can see that the request for RSC payload is being sent, and it does not contain the NEXT_NOT_FOUND error, but the client fails to update the content.

https://github.com/user-attachments/assets/5e417703-8f70-4c35-9495-20e90318adbe

Current vs. Expected behavior

Once notFound has been called on /about?q=404, clicking the /about button should correctly render the page, but instead it keeps showing the not found error.

Provide environment information
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Thu Oct 5 21:02:42 UTC 2023
  Available memory (MB): 38098
  Available CPU cores: 24
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: N/A
  pnpm: 8.15.1
Relevant Packages:
  next: 15.0.0-canary.139 // Latest available version is detected (15.0.0-canary.139).
  eslint-config-next: N/A
  react: 19.0.0-rc-fb9a90fa48-20240614
  react-dom: 19.0.0-rc-fb9a90fa48-20240614
  typescript: 5.5.4
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Navigation

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked minimal reproduction and follow the /about navigation between ?q=404 and no search params, inspecting the RSC payload and client navigation state. The work is done when navigating from /about?q=404 to /about removes the not-found boundary without a full reload, in both development and started production modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.