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 in page.tsx shows a white page on client-side navigation #67427

Open
Jens-n11 opened this issue Jul 3, 2024 · 0 comments
Open

Redirect in page.tsx shows a white page on client-side navigation #67427

Jens-n11 opened this issue Jul 3, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Navigation Related to Next.js linking (e.g., <Link>) and navigation.

Comments

@Jens-n11
Copy link

Jens-n11 commented Jul 3, 2024

Link to the code that reproduces this issue

https://github.com/Jens-n11/nextjs-redirect-example

To Reproduce

If you use a next/navigation redirect() in a page.tsx which is called via a next/Link <Link> (client side navigation) the browser will show a white page for a part of a second until the redirect happens.

  1. Start the app
  2. Open the start page (http://localhost:3000)
  3. Click on the "Next-Link with redirect"
  4. You will see for a short time a white page before the green landing page loads. Its easier to see if you throttle the connection speed.

Current vs. Expected behavior

I would expect, that next does not start rendering the new page if the page throws a redirect. I would expect the same look-and-feel with next/Link like it would be with an <a> Tag. See this example video with first the <a> Tag and then the next/link (with client side navigation):

2024-07-03.mov

Provide environment information

Doesn't really matter, but here they are:

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 14.2.4 // Latest available version is detected (14.2.4).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.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), next build (local), next start (local)

Additional context

No response

@Jens-n11 Jens-n11 added the bug Issue was opened via the bug report template. label Jul 3, 2024
@github-actions github-actions bot added the Navigation Related to Next.js linking (e.g., <Link>) and navigation. label Jul 3, 2024
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. Navigation Related to Next.js linking (e.g., <Link>) and navigation.
Projects
None yet
Development

No branches or pull requests

1 participant