vercel / vercel/next.js

Double redirect in RSC page when using a loading boundary

Open
#65,764 15 comments 4 reactions 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/PaulWild/multiple-redirects-in-rsc/

To Reproduce
  • go to /
  • Server component will redirect to /api/redirect
  • The api route is called twice as seen by the terminal logs.
Current vs. Expected behaviour

The api route should only be called once

Provide environment information
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Thu Jan 11 04:09:03 UTC 2024
  Available memory (MB): 15935
  Available CPU cores: 8
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.3.0-canary.62 // Latest available version is detected (14.3.0-canary.62).
  eslint-config-next: N/A
  react: 19.0.0-beta-4508873393-20240430
  react-dom: 19.0.0-beta-4508873393-20240430
  typescript: 5.1.3
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), Vercel (Deployed)

Additional context

This doesn't happen if there aren't any loading pages. This seems to be related to https://github.com/vercel/next.js/issues/57257

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 reproduction repository linked in the issue, visit /, and trace the server component redirect to /api/redirect while a loading boundary is present. Compare the terminal request count with and without loading pages; done means the API route is called once in the affected dev and deployed scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.