Repository navigation
fix(jsx): preserve self-closing void elements in cloneElement - #5314
Merged
Merged
Conversation
Member
|
Looks good to me. The fix makes sense and the test covers the issue. |
Contributor
Author
|
@usualoma thanks for reviewing! |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #5314 +/- ##
==========================================
+ Coverage 79.91% 80.01% +0.10%
==========================================
Files 156 156
Lines 10973 11018 +45
Branches 2316 2340 +24
==========================================
+ Hits 8769 8816 +47
+ Misses 2204 2202 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
adityajha77
force-pushed
the
fix/clone-element-empty-tags
branch
from
September 9, 2026 18:27
fd09553 to
da43399
Compare
Contributor
Author
|
Rebased on latest main and added unit test coverage for array children in cloneElement to satisfy Codecov. |
Member
|
Sorry for being late. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where
cloneElement()on elements withundefinedchildren (such as HTML void elements<img />,<input />,<br />,<hr />,<link />) wrappedundefinedinto[undefined], causing void elements to lose self-closing tag rendering in SSR.Problem
In
src/jsx/base.ts, whencloneElementwas called without new children, it extracted the existing element'sprops.children: