@@ -22,7 +22,7 @@ import { makeThemeProps, provideTheme } from '@/composables/theme'
2222import { makeVariantProps } from '@/composables/variant'
2323
2424// Utilities
25- import { computed , ref , shallowRef , toRef , watch } from 'vue'
25+ import { computed , ref , shallowRef , toRef } from 'vue'
2626import {
2727 EventProp ,
2828 focusChild ,
@@ -169,34 +169,7 @@ export const VList = genericComponent<new <
169169 const { dimensionStyles } = useDimension ( props )
170170 const { elevationClasses } = useElevation ( props )
171171 const { roundedClasses } = useRounded ( props )
172- const { children, disabled, open, parents, select, getPath } = useNested ( props )
173-
174- function flatten ( items : InternalListItem < any > [ ] ) : InternalListItem < any > [ ] {
175- return [
176- ...items ,
177- ...items . length ? flatten ( items . flatMap ( x => x . children ?? [ ] ) ) : [ ] ,
178- ]
179- }
180-
181- watch ( items , val => {
182- if ( props . itemsRegistration === 'render' ) return
183- const allNodes = flatten ( val )
184- children . value = new Map (
185- allNodes
186- . filter ( item => item . children )
187- . map ( item => [ item . value , item . children ! . map ( x => x . value ) ] )
188- )
189- parents . value = new Map (
190- allNodes
191- . filter ( item => ! val . includes ( item ) )
192- . map ( item => [ item . value , allNodes . find ( x => x . children ?. includes ( item ) ) ?. value ] )
193- )
194- disabled . value = new Set (
195- allNodes
196- . filter ( item => ( item as any ) . disabled )
197- . map ( item => item . value )
198- )
199- } , { immediate : true } )
172+ const { children, open, parents, select, getPath } = useNested ( props , items )
200173
201174 const lineClasses = toRef ( ( ) => props . lines ? `v-list--${ props . lines } -line` : undefined )
202175 const activeColor = toRef ( ( ) => props . activeColor )
0 commit comments