vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.4k stars 27.03k forks source link

Next.js 15: Same-Path Redirect in Server Action Temporarily Breaks page.tsx Display #73317

Open y-hsgw opened 23 hours ago

y-hsgw commented 23 hours ago

Link to the code that reproduces this issue

https://github.com/y-hsgw/reproduction-next-app

To Reproduce

  1. next dev
  2. Click the "go home" button

Current vs. Expected behavior

As shown in the attached video, redirecting ( redirect function ) to the same path in Next.js 15 temporarily hides the content of page.tsx. This issue did not occur in Next.js 14. (You can confirm this by changing the version of Next.js in the attached repository to 14.2.18.)

https://github.com/user-attachments/assets/edf65b80-752d-4902-8471-73b1a4e62b77

I expect it to not temporarily disappear.

While I might be misunderstanding or missing something, I would appreciate it if you could look into this matter.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 22.10.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 8.2.0
Relevant Packages:
  next: 15.0.4-canary.30 // Latest available version is detected (15.0.4-canary.30).
  eslint-config-next: N/A
  react: 19.0.0-rc-b01722d5-20241114
  react-dom: 19.0.0-rc-b01722d5-20241114
  typescript: 5.3.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)

Additional context

No response

luke-concannon commented 15 hours ago

Experiencing the same issue from next@15.0.0

Redirecting in server action to pathname with same root param is triggering my issue. But no issue if redirecting to a different root param

e.g. adding a list item in /list/2/item/3 and redirecting to new list item at /list/2/item/4 triggers unexpected behaviour but /list/2/item/3 to /list/3/item/4 behaves as expected.