From 6e994daf794a68cc05dcda8b3d65e7d1a7adbf33 Mon Sep 17 00:00:00 2001 From: Matt Barlow Date: Tue, 22 Oct 2019 22:06:41 +0100 Subject: [PATCH] Fix #20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not too sure why this works, or rather, why it doesn’t work without this rather strange approach. Unless I’m mistaken, the correct return value when `nodes.length < 2 && !nodes[0].text` is true should be `nodes[0]` rather than just `nodes` (as `nodes` is an array, not a VNode). However, returning just `nodes[0]` does not fix the bug where the portal contents don’t render as described in #20. Calling `createElement` on its constituent parts works, despite the output of the function and the initial `nodes[0]` VNode appearing identical upon inspection. --- src/components/TargetContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TargetContainer.js b/src/components/TargetContainer.js index 76e96c5..ebd1e3e 100644 --- a/src/components/TargetContainer.js +++ b/src/components/TargetContainer.js @@ -14,7 +14,7 @@ export default Vue.extend({ const nodes = this.updatedNodes && this.updatedNodes() if (!nodes) return h() return nodes.length < 2 && !nodes[0].text - ? nodes + ? h(nodes[0].tag, nodes[0].data, nodes[0].children) : h(this.tag || 'DIV', nodes) }, destroyed() {