Skip to content

Fix hydration error on V2 #3272

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

Merged
merged 3 commits into from
Jun 2, 2025
Merged

Fix hydration error on V2 #3272

merged 3 commits into from
Jun 2, 2025

Conversation

conico974
Copy link
Contributor

Inserting an inline link inside a card would cause an <a> tag to be nested inside another <a> tag.
This cause an hydration error in GBO v2, and initial render from the server would not render properly and the card would only appear after client hydration.

Copy link

linear bot commented May 30, 2025

Copy link

changeset-bot bot commented May 30, 2025

🦋 Changeset detected

Latest commit: a4430fa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

argos-ci bot commented May 30, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v1 (Inspect) ✅ No changes detected - Jun 1, 2025, 7:18 PM
customers-v2 (Inspect) 👍 Changes approved 79 changed Jun 1, 2025, 7:22 PM
default (Inspect) ✅ No changes detected - Jun 1, 2025, 7:22 PM
v2-cloudflare (Inspect) ✅ No changes detected - Jun 1, 2025, 7:22 PM
v2-vercel (Inspect) ✅ No changes detected - Jun 1, 2025, 7:22 PM

Copy link
Member

@SamyPesse SamyPesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this is a solution and why we need to change CSS to fix this problem. Maybe I'm missing something, but from my understanding the only solution is to make sure that the inline link doesn't render as a <a>.
I think the best solution is to have a React context in Link.tsx and if it's a nested link, we instead render a <span> with some onClick to trigger navigation (also stop propagation). These <Link> could also re-render after hydration to actually render a <a>.

@emmerich emmerich merged commit 7d5a6d2 into main Jun 2, 2025
21 checks passed
@emmerich emmerich deleted the cloudflare/rnd-7231 branch June 2, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants