vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.61k stars 6.95k forks source link

[Bug Report][3.6.8] (VTreeview) treeview treating empty children array differently to vuetify ^2.5.8 #19983

Closed mcc0rmack closed 2 weeks ago

mcc0rmack commented 2 months ago

Environment

Vuetify Version: 3.6.8 Last working version: ^2.5.8 Vue Version: 3.4.27 Browsers: Edge 126.0.0.0 OS: Windows 10

Steps to reproduce

As per link, previously empty children array was ignored.

Now it prevents slots from firing, so icons etc no longer work

Expected Behavior

empty children array is ignored and treated as having no children.

Actual Behavior

thinks there are children, shows tree arrow and cannot fire slots

Reproduction Link

https://play.vuetifyjs.com/#...

robertzak commented 1 month ago

can this be tagged with C:VTreeview? I was going to put in this ticket as well and almost missed someone else had because it wasn't showing up when I filtered to look at the active issues for VTreeview.

Also I second that this be fixed. It looks like it used to be a problem in vuetify 2.x as well and was fixed for this issue: https://github.com/vuetifyjs/vuetify/issues/5357

KaelWD commented 2 weeks ago

Duplicate of #18172

robertzak commented 2 weeks ago

So is the expectation that even if we don't provide a loadChildren function an empty array will still be rendered as though children are present in the tree? Is the fix for this to make sure any children are undefined rather than an empty array? I've been waiting on this (and several other fixes) to the tree so we can finish our upgrade to vue3

KaelWD commented 2 weeks ago

Yes. You can also pass a custom itemChildren function if it isn't possible to change the items structure:

:item-children="item => item.children.length ? item.children : null"
robertzak commented 2 weeks ago

OK. Thank you. I'll give the function a try before trying to rewrite the tree data.