Skip to content

Commit

Permalink
Allow an async component to return null rendering (#1438)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Miller <developit@users.noreply.github.com>
  • Loading branch information
VanTanev and developit committed Oct 30, 2020
1 parent 6670ba0 commit 2c53b0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-dolls-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"preact-cli": patch
---

fix: allow an async component to return null rendering
11 changes: 5 additions & 6 deletions packages/async-loader/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ export default function async(load) {
const me =
(prev && prev.nextSibling) || (this.__P || this._parentDom).firstChild;

return (
me &&
h(me.localName, {
dangerouslySetInnerHTML: PENDING,
})
);
if (!me) return;
if (me.nodeType === 3) return me.data;
return h(me.localName, {
dangerouslySetInnerHTML: PENDING,
});
};
}

Expand Down

0 comments on commit 2c53b0a

Please sign in to comment.