Skip to content

fix: resolve hydration mismatch in img alt attribute (#2340)#2397

Merged
vtushar06 merged 1 commit into
json-schema-org:mainfrom
Sravan1011:fix/hydration-mismatch-img-alt-2340
Jun 17, 2026
Merged

fix: resolve hydration mismatch in img alt attribute (#2340)#2397
vtushar06 merged 1 commit into
json-schema-org:mainfrom
Sravan1011:fix/hydration-mismatch-img-alt-2340

Conversation

@Sravan1011

@Sravan1011 Sravan1011 commented May 8, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix - Resolves hydration mismatch warnings in React/Next.js

Issue Number:

Closes #2340

Summary

This PR fixes hydration mismatch warnings that occur when server-rendered and client-rendered content differs. The changes include:

  • Added missing alt='octue' attribute to the octue sponsor image
  • Fixed multi-line alt text on the apideck image (collapsed to single line)
  • Fixed incorrect alt on sourcemeta image (was 'dottxt logo', now 'sourcemeta logo')
  • Wrapped all 14 raw tags in {isClient && (<>...</>)} guards to prevent server/client theme mismatch, consistent with the existing pattern used by all other components on the page

Does this PR introduce a breaking change?

No, this is a non-breaking bug fix that only improves hydration compatibility.

Checklist

  • My changes follow the project's code style
  • I have updated relevant documentation
  • All tests pass
  • This PR is ready for review
image

…#2340)

- Add missing alt attribute to octue sponsor image
- Fix multi-line alt text on apideck image causing whitespace normalization mismatch
- Fix incorrect alt text on sourcemeta image (was 'dottxt logo')
- Wrap all raw <img> tags in {isClient && ...} guards to prevent
  server/client theme-dependent src mismatch, matching the pattern
  already used by <Image> components
@Sravan1011 Sravan1011 requested a review from a team as a code owner May 8, 2026 04:07
@github-project-automation github-project-automation Bot moved this to Ready to review in PR - Triage Group May 8, 2026
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Hi @Sravan1011! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: issue reference, kind of change description

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 0fba4e1

@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (07eca45) to head (0fba4e1).
⚠️ Report is 39 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2397   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines          672       672           
  Branches       211       211           
=========================================
  Hits           672       672           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Hi @Sravan1011! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: kind of change description

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

1 similar comment
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Hi @Sravan1011! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: kind of change description

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

@vtushar06

Copy link
Copy Markdown
Collaborator

Hey @Sravan1011, I have verified the fix in the codebase, isClient guards are fully justified since the mismatch is actually on src attributes (logos.X from resolvedTheme), not just alt. your approach is consistent with the existing 19 guards in the same file.
One thing I am not sure about locally I count 9 unguarded tags but your PR says 14 - can you confirm the extra 5 are new sponsor images? Also please fill in the "kind of change" field in the PR description, the body validation check is failing because of it.

@Sravan1011

Copy link
Copy Markdown
Contributor Author

Hi! To clarify the count — yes, the extra 5 tags compared to your local 9 are new sponsor images that were added to main after your local clone. Here's the breakdown

N-iX (logos.nix) ef67cf6 – "Add nix as a bronze sponsor"
Oracle (logos.oracle) b99ca15 – "add oracle logo"
Spin the Wheel (logos.spinthewheel) f20afb0 – "feat: add 3 new bronze sponsors"
Litslink (logos.litslink) f20afb0 – "feat: add 3 new bronze sponsors"
Time Now (logos.timenow) f20afb0 – "feat: add 3 new bronze sponsors"
My PR wraps all 14 unguarded tags (your original 9 + these 5 newer ones) with {isClient && (<>...</>)} guards to prevent the server/client theme mismatch

@vtushar06

Copy link
Copy Markdown
Collaborator

Also please fill in the "kind of change" field in the PR description, the body validation check is failing because of it.

Please fix this and PR is good to go then.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

Hi @Sravan1011! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: kind of change description

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

@Sravan1011

Copy link
Copy Markdown
Contributor Author

Also please fill in the "kind of change" field in the PR description, the body validation check is failing because of it.

Please fix this and PR is good to go then.

I have update the description of pr, now no test is failing you can go ahead with the merge

@vtushar06 vtushar06 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM🚀

@Sravan1011

Copy link
Copy Markdown
Contributor Author

LGTM🚀

so when is it going to get merged?

@vtushar06 vtushar06 merged commit 26ff5af into json-schema-org:main Jun 17, 2026
11 of 15 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to review to Done in PR - Triage Group Jun 17, 2026
@github-actions

Copy link
Copy Markdown

Congratulations, @Sravan1011 for your first pull request merge in this repository! 🎉🎉. Thanks for your contribution to JSON Schema!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Hydration mismatch in img alt attribute (server vs client)

2 participants