Skip to content

redirect in server action and revalidateTag cause a parallel route to lose its active state #64728

Closed
@roksui

Description

@roksui

Link to the code that reproduces this issue

https://github.com/roksui/my-nextagram

To Reproduce

  1. Clone the repository and checkout to the master branch.
  2. Start the applicatin in dev mode using npm run dev.
  3. Go to "/login" page and press the Login button.
  4. Click on photo 1 and inside the modal click on the add comment button.
  5. The parallel route behind the modal loses its active state and turns blank.

Current vs. Expected behavior

I expected the parallel route segment behind the modal to not lose its active state when the router cache is cleared when calling revalidateTag in a server action which should only update the data inside the modal. However, I observed that while the data is successfully revalidated in the modal, the parallel route behind the modal loses its active state.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 32545
  Available CPU cores: 16
Binaries:
  Node: 18.17.1
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.3.0-canary.9 // Latest available version is detected (14.3.0-canary.9).
  eslint-config-next: 14.1.1-canary.52
  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)

Parallel & Intercepting Routes

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

next dev (local), next start (local)

Additional context

  • This bug was introduced in 14.3.0-canary.5 (supposedly with the PR fix refresh behavior for discarded actions #64532).
  • When looking at the Chrome dev tool's network tab when clicking on the button for adding a comment, after revalidateTag("comments") is called, the browser receives a RSC payload for the "/login" route. Now, when I remove redirect("/") inside the server action for the login, this RSC payload is not received after clicking on the add comment button.
  • If I use a version before 14.3.0-canary.5, the background segment doesn't lose its active state, however occasionally, the comment list is not revalidated and updated in the modal straight away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions