Skip to content

Commit 9e1cfbd

Browse files
authored
fix(VTreeview): remove redundant treeview re-render during open (#19968)
1 parent d8e8a0c commit 9e1cfbd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/vuetify/src/components/VList/VList.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export const makeVListProps = propsFactory({
9797

9898
'onClick:open': EventProp<[{ id: unknown, value: boolean, path: unknown[] }]>(),
9999
'onClick:select': EventProp<[{ id: unknown, value: boolean, path: unknown[] }]>(),
100+
'onUpdate:opened': EventProp<[]>(),
100101
...makeNestedProps({
101102
selectStrategy: 'single-leaf' as const,
102103
openStrategy: 'list' as const,

packages/vuetify/src/labs/VTreeview/VTreeview.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import { useProxiedModel } from '@/composables/proxiedModel'
99

1010
// Utilities
1111
import { computed, provide, ref, toRef, watch } from 'vue'
12-
import { genericComponent, omit, propsFactory, useRender } from '@/util'
12+
import { genericComponent, getCurrentInstance, omit, propsFactory, useRender } from '@/util'
1313

1414
// Types
15+
import type { ExtractPublicPropTypes } from 'vue'
1516
import { VTreeviewSymbol } from './shared'
1617
import type { VListChildrenSlots } from '@/components/VList/VListChildren'
1718
import type { ListItem } from '@/composables/list-items'
@@ -59,6 +60,7 @@ export const VTreeview = genericComponent<new <T>(
5960
},
6061

6162
setup (props, { slots }) {
63+
const vm = getCurrentInstance('VTreeview')
6264
const { items } = useListItems(props)
6365
const activeColor = toRef(props, 'activeColor')
6466
const baseColor = toRef(props, 'baseColor')
@@ -146,7 +148,8 @@ export const VTreeview = genericComponent<new <T>(
146148
})
147149

148150
useRender(() => {
149-
const listProps = VList.filterProps(props)
151+
const listProps = VList.filterProps(vm.vnode.props! as ExtractPublicPropTypes<typeof makeVTreeviewProps>)
152+
150153
const treeviewChildrenProps = VTreeviewChildren.filterProps(props)
151154

152155
return (
@@ -158,7 +161,6 @@ export const VTreeview = genericComponent<new <T>(
158161
props.class,
159162
]}
160163
style={ props.style }
161-
v-model:opened={ opened.value }
162164
v-model:activated={ activated.value }
163165
v-model:selected={ selected.value }
164166
>

0 commit comments

Comments
 (0)