Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect from Server Action executes hard navigation #60814

Closed
1 task done
swa-legste opened this issue Jan 18, 2024 · 1 comment
Closed
1 task done

Redirect from Server Action executes hard navigation #60814

swa-legste opened this issue Jan 18, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template.

Comments

@swa-legste
Copy link

swa-legste commented Jan 18, 2024

Link to the code that reproduces this issue

https://github.com/swa-legste/next-reproduction

To Reproduce

  1. Start the application in development (next dev)
  2. Open applicaiton over http://localhost:3000
  3. click on any "Add To Cart" button
  4. wait until action completion

Current vs. Expected behavior

expected
After "Add to Cart" the page is redirected to the /basket url. Given that /basket is parallel route (drawing an overlay) with a null default on main slot I'm expecting to see the basket overlay while keeping the main slot unchanged as follow:
image
note that this can be seen by navigating to the basket from the header link.

actual
Instead the main slot is empty:
image

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Mon Jan  1 18:15:01 PST 2024
Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: 1.22.21
  pnpm: 8.14.0
Relevant Packages:
  next: 14.0.5-canary.65
  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
Routing (next/router, next/navigation, next/link)

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

next dev (local), next start (local)

Additional context

The server action executes a redirect which is taken as a hard redirect from the browser? This might be related to #54173 and partially fixed (at least redirects executes) by #59585.

Root cause being the redirect('/basket') in the server action.

Whil this might be the exepcetd behavior it makes using parallel routes for modal cumbersome.

also tested against latest canary 14.1.1-canary.1

@swa-legste
Copy link
Author

this is fixed by #63607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

1 participant