Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwu9145 committed Jan 18, 2025
1 parent d7e1739 commit 24dab5c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/vuetify/src/composables/nested/nested.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const useNested = (props: NestedProps) => {
const children = ref(new Map<unknown, unknown[]>())
const parents = ref(new Map<unknown, unknown>())

const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(toRaw(v)), v => [...v.values()])
const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(v), v => [...v.values()])

const activeStrategy = computed(() => {
if (typeof props.activeStrategy === 'object') return props.activeStrategy
Expand Down
7 changes: 2 additions & 5 deletions packages/vuetify/src/composables/nested/openStrategies.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Utilities
import { toRaw } from 'vue'

export type OpenStrategyFn = (data: {
id: unknown
value: boolean
Expand Down Expand Up @@ -50,12 +47,12 @@ export const singleOpenStrategy: OpenStrategy = {
export const multipleOpenStrategy: OpenStrategy = {
open: ({ id, value, opened, parents }) => {
if (value) {
let parent = toRaw(parents.get(id))
let parent = parents.get(id)
opened.add(id)

while (parent != null && parent !== id) {
opened.add(parent)
parent = toRaw(parents.get(parent))
parent = parents.get(parent)
}

return opened
Expand Down
4 changes: 2 additions & 2 deletions packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const VTreeviewChildren = genericComponent<new <T extends InternalListIte
return children ? (
<VTreeviewGroup
{ ...treeviewGroupProps }
value={ props.returnObject ? toRaw(item.raw) : treeviewGroupProps?.value }
value={ props.returnObject ? item.raw : treeviewGroupProps?.value }
>
{{
activator: ({ props: activatorProps }) => {
Expand All @@ -143,7 +143,7 @@ export const VTreeviewChildren = genericComponent<new <T extends InternalListIte
return (
<VTreeviewItem
{ ...listItemProps }
value={ props.returnObject ? toRaw(item.raw) : itemProps.value }
value={ props.returnObject ? item.raw : itemProps.value }
loading={ loading }
v-slots={ slotsWithItem }
/>
Expand Down

0 comments on commit 24dab5c

Please sign in to comment.