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

v-show is invalid on the DEV_ROOT_FRAGMENT node. #5523

Closed
ygj6 opened this issue Mar 5, 2022 · 2 comments
Closed

v-show is invalid on the DEV_ROOT_FRAGMENT node. #5523

ygj6 opened this issue Mar 5, 2022 · 2 comments
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working

Comments

@ygj6
Copy link
Member

ygj6 commented Mar 5, 2022

Version

3.2.31

Reproduction link

sfc.vuejs.org/

Steps to reproduce

Observation hello

What is expected?

hello should twinkling

What is actually happening?

v-show = false invalid

@posva
Copy link
Member

posva commented Mar 5, 2022

Since v show changed the display style property, isn’t this just expected? The component needs to have a root node or to explicitly use v-bind=$attrs

@ygj6
Copy link
Member Author

ygj6 commented Mar 7, 2022

I think this node is a single root node,

export function filterSingleRoot(
children: VNodeArrayChildren
): VNode | undefined {
let singleRoot
for (let i = 0; i < children.length; i++) {
const child = children[i]
if (isVNode(child)) {
// ignore user comment
if (child.type !== Comment || child.children === 'v-if') {
if (singleRoot) {
// has more than 1 non-comment child, return now
return
} else {
singleRoot = child
}
}
} else {
return
}
}
return singleRoot
}

And it behaves differently than the production mode.

@posva posva added 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working labels Mar 7, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants