Skip to content

Render inner blocks when wrapper markup is null#15

Merged
vonloxx merged 7 commits into
mainfrom
fix/remove-type-module
Jun 19, 2026
Merged

Render inner blocks when wrapper markup is null#15
vonloxx merged 7 commits into
mainfrom
fix/remove-type-module

Conversation

@vonloxx

@vonloxx vonloxx commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix blocks that contain only inner blocks (no surrounding HTML) rendering the literal text null[innerBlocks]null and dropping their children.
  • Add a regression test covering the null-wrapper case.
  • Bump to 1.4.3.

Why

  • When a block has inner blocks but no wrapper markup, the parser serializes innerContent as [null, null]. The wrapper template interpolated those nulls directly, producing the string "null[innerBlocks]null". That no longer matched the [innerBlocks] marker, so it was emitted as visible text and the inner blocks never rendered. Observed on the sikt.no /arrangementer page.

Notes

  • The fix null-coalesces the leading/trailing wrapper segments to empty strings, preserving the [innerBlocks] marker.
  • The added test fails on the previous behavior (leaked null text) and passes with the fix; full suite is 31/31.
  • This branch also carries the previously-published CommonJS / type-module commits (1.4.2) that were never merged back to main; merging this PR reconciles main with the published release line.

- Removed type: module from package.json
- Fixes MODULE_NOT_FOUND error in Next.js builds
- Maintains ESM output via Babel configuration
- Removed modules:false from Babel preset-env to generate CommonJS
- Removed .js extensions from imports (not needed for CommonJS)
- Fixes SyntaxError on Vercel while maintaining localhost compatibility
- Removed type:module declaration (using CommonJS now)
A block that contains only inner blocks with no surrounding HTML
serializes to innerContent === [null, null]. The wrapper template
interpolated those nulls directly, producing the literal string
"null[innerBlocks]null". That no longer matched the "[innerBlocks]"
marker, so it rendered as visible text on the page and the inner
blocks were dropped entirely.

Null-coalesce the leading and trailing wrapper segments to empty
strings so the marker is preserved and the inner blocks render.

Add a regression test that fails on the old behavior (leaked "null"
text) and passes with the fix.
@vonloxx vonloxx merged commit 07444cf into main Jun 19, 2026
1 check passed
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.

1 participant