dillon1000/react

Commit

Improve error behavior of Danger.dangerouslyRenderMarkup.

HTML comment nodes are now interspersed in the original markup list so
that we can tell which chunks of markup rendered as more or less than one
node, and give a more helpful error message in that case.

Regardless of how many nodes were rendered, we only take the first one. If
zero nodes were rendered, then `resultList` will contain `null` at the
corresponding position.

If we decide to revisit the idea of using document fragments, it will be
very easy to handle the `!== 1` case by returning a document fragment.
Browse files
Changed paths2 files
First-parent comparison
M src/dom/Danger.js ModifiedM src/dom/__tests__/Danger-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…