next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Parallel + Intercepted route causes 404 when setting cookie in Server Action

Open mordechaim opened this issue 1 year ago • 1 comments

Link to the code that reproduces this issue

https://github.com/mordechaim/intercepted-not-found

To Reproduce

  1. Check out deployment at https://intercepted-not-found.vercel.app/
  2. Hard navigate to login page https://intercepted-not-found.vercel.app/login
  3. Set cookie action: works perfectly.
  4. Soft navigate to login page from home via link
  5. Set cookie action in intercepted form: 404

Current vs. Expected behavior

When setting cookie, or any other server action that clear the client-side router cache, there's an error in the console:

No default component was found for a parallel route rendered on this page. Falling back to nearest NotFound boundary.
Learn more: https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#defaultjs

The main page then changes to a 404, while the intercepted page is still present all the way at the bottom.

I would expect the form to behave exactly the same regardless if the router cache is cleared or not.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
Binaries:
  Node: 20.5.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.1.1-canary.4 // Latest available version is detected (14.1.1-canary.4).
  eslint-config-next: 14.1.1-canary.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, Routing (next/router, next/navigation, next/link)

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

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

Additional context

No response

mordechaim avatar Jan 21 '24 19:01 mordechaim

Similar issue, setting cookie in a server action works perfect, however, if we run into notFound route, the server action blows up after successfully running, causing a 500.

nick-barth avatar Jan 31 '24 20:01 nick-barth

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

github-actions[bot] avatar Apr 12 '24 00:04 github-actions[bot]