json-schema-org / json-schema-org/website

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

Open
#2,256 3 comments 0 reactions 1 assignee View on GitHub

@h30s is already working on this.

Since Feb 21, 2026.

🐛 Bug Status: Stale Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug

There is a logic flaw in the checkHasContent utility function (lib/markdownUtils.ts) that causes a complete page crash when a Markdown table header has exactly one column.

The function assumes reactNode.props.children is an array and calls .reduce() on it. However, if a component only has one child in React, props.children is an object, not an array. When markdown-to-jsx renders a single-column table, props.children on the <tr> wrapper is a single <th> object. Calling .reduce() on this object throws TypeError: reactNode.props.children.reduce is not a function, crashing the entire page render.

Steps To Reproduce
  1. Create or edit a markdown file rendered via StyledMarkdownBlock.
  2. Add a table with only one column:
  3. Load the page locally or in preview.
  4. See the TypeError complete page crash in the browser console / terminal.
Expected Behavior

The page should render the single-column table correctly without crashing. The utility function should safely iterate React children using React.Children.toArray() or check Array.isArray() before assuming array methods are available.

Screenshots

No response

Device Information [optional]
- OS:
- Browser:
- version:
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.