From 898a78922fb12b9aa000769b1eb8478139fdc54d Mon Sep 17 00:00:00 2001 From: Andrew Sobolev Date: Mon, 6 Jul 2020 16:35:23 +0700 Subject: [PATCH] * fix error if parentNode not exist --- src/preact-portal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/preact-portal.js b/src/preact-portal.js index 2d46583..d4f29fe 100644 --- a/src/preact-portal.js +++ b/src/preact-portal.js @@ -22,9 +22,10 @@ export default class Portal extends Component { } componentWillUnmount() { + if (this.remote && !this.remote.parentNode) return; this.renderLayer(false); this.isMounted=false; - if (this.remote && this.remote.parentNode) this.remote.parentNode.removeChild(this.remote); + this.remote.parentNode.removeChild(this.remote); } findNode(node) {