Skip to content

fix(dom-to-react): default props.children to undefined instead of null#1127

Merged
remarkablemark merged 1 commit intomasterfrom
fix/dom-to-react
Oct 29, 2023
Merged

fix(dom-to-react): default props.children to undefined instead of null#1127
remarkablemark merged 1 commit intomasterfrom
fix/dom-to-react

Conversation

@remarkablemark
Copy link
Copy Markdown
Owner

@remarkablemark remarkablemark commented Oct 29, 2023

What is the motivation for this pull request?

fix(dom-to-react): default props.children to undefined instead of null

What is the current behavior?

props.children defaults to null. E.g., parse('<br>'):

{
  '$$typeof': Symbol(react.element),
  type: 'br',
  key: null,
  ref: null,
  props: { children: null },
  _owner: null,
  _store: {}
}

What is the new behavior?

props.children defaults to undefined

This ensures the parsed element is consistent with the React element <br >:

{
  '$$typeof': Symbol(react.element),
  type: 'br',
  key: null,
  ref: null,
  props: {},
  _owner: null,
  _store: {}
}

Checklist:

@remarkablemark remarkablemark added the bug Something isn't working label Oct 29, 2023
@remarkablemark remarkablemark self-assigned this Oct 29, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 29, 2023

Codecov Report

Merging #1127 (a6978c3) into master (57571aa) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #1127   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          153       153           
  Branches        50        50           
=========================================
  Hits           153       153           
Files Coverage Δ
src/dom-to-react.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
dist/html-react-parser.min.js 10.2 KB (0%) 205 ms (0%) 26 ms (+104.93% 🔺) 230 ms

@remarkablemark remarkablemark merged commit 6f9ae44 into master Oct 29, 2023
@remarkablemark remarkablemark deleted the fix/dom-to-react branch October 29, 2023 19:41
@remarkablemark
Copy link
Copy Markdown
Owner Author

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant