vercel / vercel/next.js

App Dir: Avoid intercepted route for hard navigated page

Open
#51,648 17 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Parallel & Intercepting Routes
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Verify canary release
  • I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
      Platform: linux
      Arch: x64
      Version: #22 SMP Tue Jan 10 18:39:00 UTC 2023
    Binaries:
      Node: 18.14.2
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.4.7-canary.4
      eslint-config-next: 13.4.7
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4
Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue or a replay of the bug

https://codesandbox.io/p/sandbox/dazzling-hooks-fz6pjv

To Reproduce
  1. Run the code sandbox
  2. Navigate to the search modal using the Search button
  3. Type a query
  4. Refresh the page, full search page should open
  5. Update the search query using input control
  6. The search modal should also show up, along with the page updated.

The search modal should not show up.

Describe the Bug
  1. The home page contains list of articles.
  2. There is a Search button that opens the intercepted /search route in a Modal
  3. On typing in the input, search is supposed to happen (not implemented), url is updated with query string. e.g. /search?q=food

All Good so far.

  1. Now when a User refreshes the page, the full search page appears. say for url /search?q=food
  2. On the page, if user tries to update the search query, the page is updated as well as opens the intercepted /search route in a Modal

Since the user is already on the full /search page, there should not be any requirement to again open the intercepted route

Expected Behavior

When updating the route with a new query string, the page should get updated and not show the intercepted route modal. As the page is already loaded and should not be again intercepted.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

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 CodeSandbox and reproducing the flow through the App Router: open the intercepted /search modal, refresh, then change the query string. Read the intercepted-route and hard-navigation behavior involved in the reproduction. Done means updating the query on the full /search page changes the page without reopening the modal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, 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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.