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

Links will sometimes hide the entire page when clicked #34464

Closed
1 task done
leo opened this issue Feb 17, 2022 · 4 comments · Fixed by #34475
Closed
1 task done

Links will sometimes hide the entire page when clicked #34464

leo opened this issue Feb 17, 2022 · 4 comments · Fixed by #34475

Comments

@leo
Copy link
Contributor

leo commented Feb 17, 2022

Verify canary release

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

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101
Binaries:
  Node: 16.14.0
  npm: 8.3.1
  Yarn: 1.22.17
  pnpm: 6.30.1
Relevant packages:
  next: 12.0.11-canary.20
  react: 18.0.0-rc.0
  react-dom: 18.0.0-rc.0

What browser are you using? (if relevant)

Chrome 98.0.4758.80 (arm64)

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

Clicking a Link that happens to have the same href as the current page causes the entire page to empty.

Here's an example:

CleanShot.2022-02-17.at.11.09.48.mp4

This problem only seems to happen with React Server Components enabled.

Expected Behavior

Clicking a Link that happens to have the same href as the current page should not cause the entire page to go empty.

Instead, it should behave exactly like without React Server Components enabled: You just continue to see the current page without any problems.

To Reproduce

  1. Clone the Vercel's next-react-server-components example
  2. Add <Link href="/rsc">This link points to the current page</Link> in pages/rsc.server.js
  3. Click the link and watch the whole page go empty
@leo leo added the bug Issue was opened via the bug report template. label Feb 17, 2022
@leo leo changed the title Self-referencing Links will empty the entire page when clicked (RSC) Self-referencing Links will empty the entire page when clicked Feb 17, 2022
@leo leo changed the title Self-referencing Links will empty the entire page when clicked Links will sometimes empty the entire page when clicked Feb 17, 2022
@leo
Copy link
Contributor Author

leo commented Feb 17, 2022

In addition to the problem described above, I also had been talking about another problem with @huozhi for the past couple days, which is one where every single Link click, even if it points to a completely different route, causes the page to go empty for a split second.

After digging a bit deeper, it turns out that, in both cases, display: none is applied to the root elements by Next.js/React, so the root problem might actually be the same for both.

Note that the screenshot I'm showing below is from Vercel's next-react-server-components example, so there's no code present in there that could cause these styles to be added. It must be Next.js or React.

CleanShot 2022-02-17 at 12 08 21@2x

@leo leo changed the title Links will sometimes empty the entire page when clicked Links will sometimes hide the entire page when clicked Feb 17, 2022
@balazsorban44 balazsorban44 added kind: bug and removed bug Issue was opened via the bug report template. labels Feb 17, 2022
@kodiakhq kodiakhq bot closed this as completed in #34475 Feb 17, 2022
kodiakhq bot pushed a commit that referenced this issue Feb 17, 2022
## Bug

Fixes #34464

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
@leo
Copy link
Contributor Author

leo commented Feb 18, 2022

Thanks for landing the PR, @huozhi!

The issue of self-referencing Links causing a hidden page is now fixed.

The issue of the page temporarily hiding on every page transition remains, but I can try to create a separate reproduction case for that, so we can solve that too.

@huozhi
Copy link
Member

huozhi commented Feb 18, 2022

I feel like it's still related to top-level suspense. I took a note for this. Thanks for reporting 👍

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants