Skip to content

fix: prevent React crash on single-child table headers #2256#2261

Open
h30s wants to merge 2 commits intojson-schema-org:mainfrom
h30s:fix/single-child-table-crash-2256
Open

fix: prevent React crash on single-child table headers #2256#2261
h30s wants to merge 2 commits intojson-schema-org:mainfrom
h30s:fix/single-child-table-crash-2256

Conversation

@h30s
Copy link

@h30s h30s commented Feb 21, 2026

What kind of change does this PR introduce?
Bugfix

Issue Number:

Screenshots/videos:
N/A

If relevant, did you update the documentation?
No

Summary
This PR resolves a page crash that happens when rendering single-column Markdown tables. The checkHasContent utility was assuming reactNode.props.children is always an array and calling .reduce(). However, React provides a single object when there's only one child. I wrapped the children with React.Children.toArray() to safely normalize before iterating. Also added a Cypress component test to catch regressions.

Does this PR introduce a breaking change?
No

Checklist

Please ensure the following tasks are completed before submitting this pull request.

@h30s h30s requested a review from a team as a code owner February 21, 2026 18:35
@github-project-automation github-project-automation bot moved this to Ready to review in PR - Triage Group Feb 21, 2026
@github-actions
Copy link

github-actions bot commented Feb 21, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 503b444

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2ee67ff) to head (503b444).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2261   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines          663       663           
  Branches       205       205           
=========================================
  Hits           663       663           

☔ View full report in Codecov by Sentry.
📢 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.

@h30s
Copy link
Author

h30s commented Feb 22, 2026

Hi @Utkarsh-123github, @jagpreetrahi, and @vtushar06 requesting your kind review on this PR at your convenience.

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

Labels

None yet

Projects

Status: Ready to review

Development

Successfully merging this pull request may close these issues.

🐛 Bug: React rendering crash in StyledMarkdownBlock for single-child table headers

1 participant