Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #20 #33

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Fix #20 #33

wants to merge 1 commit into from

Conversation

mpbarlow
Copy link

@mpbarlow mpbarlow commented Oct 22, 2019

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 is working, but as far as I can tell, the output of the function and the initial nodes[0] VNode are identical. Does a VNode have some sort of affinity to its parent component maybe?

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 LinusBorg#20. Calling `createElement` on its constituent parts works, despite the output of the function and the initial `nodes[0]` VNode appearing identical upon inspection.
@@ -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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! So as I just explained in #20, I can't reproduce this locally, which might be due to the version of Vue I'm using vs. people reporting this issue.

Nonetheless, it would be more correct to simply return the single node like this:

Suggested change
? h(nodes[0].tag, nodes[0].data, nodes[0].children)
? node[0]

Can you verify wether this works for you?

Copy link
Author

@mpbarlow mpbarlow Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thank you for getting back to me.

In the latest version of Vue, this issue appears to no longer be occurring. Unfortunately, even though I went back to the version that was current at the time I opened the PR (2.6.9), and then to 2.6.8, I can't replicate it there anymore either.

I do remember that just returning the single node (as per your suggested change) didn't work, because it was the first thing I tried and I couldn't understand why (or why wrapping its data in a call to h() did work).

I'm sorry I can't be more help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants