vercel / vercel/next.js

Suspense fallback not being displayed when updating query params and having multiple suspenses in a single page

Open
#62,049 11 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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://codesandbox.io/p/devbox/jolly-grass-5t82t8

To Reproduce
  1. Start the application
  2. Click the "Update Query Params" button
  3. No loading will be shown
  4. Remove the"FirstAsyncComponent" from the page
  5. Click the "Update Query Params" button
  • Now the loading is displayed properly as soon as we click the button
Current vs. Expected behavior

Current behaviour

  • With multiple Suspense components with different keys no fall back is shown when clicking the button and the query param only updates in the url after the loading, but in the code if we console.log the searchParams it is updated instantly

Expected behaviour

  • When pressing the button independently of the number of Suspenses, the one using the query param as a key should display the fallback
Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
Binaries:
  Node: 20.4.0
  npm: 9.7.2
  Yarn: 1.22.18
  pnpm: 8.6.2
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.0.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

App Router

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

next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

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 with the linked CodeSandbox reproduction and follow the steps for updating query parameters with multiple Suspense components. Compare the behavior with FirstAsyncComponent removed, then verify that the Suspense boundary keyed by the query parameter displays its fallback regardless of the number of Suspense components.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
frontend
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.