Skip to content

Comments

fix(VTreeview): make sure toRaw is used on children#22640

Open
Lisiadito wants to merge 1 commit intovuetifyjs:masterfrom
Lisiadito:fix/22533-search-return-object-not-returning-children
Open

fix(VTreeview): make sure toRaw is used on children#22640
Lisiadito wants to merge 1 commit intovuetifyjs:masterfrom
Lisiadito:fix/22533-search-return-object-not-returning-children

Conversation

@Lisiadito
Copy link

@Lisiadito Lisiadito commented Feb 23, 2026

Description

resolves #22533
This change makes sure that reactive children can be found in the Map. Before this only worked with non reactive children.

Markup:

<template>
  <div>
    <v-text-field v-model="search" label="Search" />
    <v-treeview
      :items="servers"
      :load-children="loadChildren"
      :search="search"
      density="compact"
      item-title="name"
      item-value="path"
      open-on-click
      return-object
    />
  </div>
</template>

<script setup>
  import { ref, shallowRef } from 'vue'

  const search = shallowRef(null)
  const servers = ref([
    {
      type: 'Server',
      name: 'Server1',
      path: 'server1',
      children: [
        {
          type: 'Directory',
          name: 'Dir1',
          path: 'server1/dir1',
          children: [],
        },
        {
          type: 'Directory',
          name: 'Dir2',
          path: 'server1/dir2',
          children: [],
        },
      ],
    },
  ])

  const loadChildren = item =>
    new Promise(resolve => {
      setTimeout(() => {
        resolve([
          {
            type: 'File',
            name: 'file1.txt',
            size: 0,
            path: item.path + '/file1.txt',
          },
          {
            type: 'File',
            name: 'file2.txt',
            size: 0,
            path: item.path + '/file2.txt',
          }])
      }, 1000)
    })
      .then(data => {
        item.children = data
      })
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.11.6] load-children + return-object + search do not work properly in VTreeView

1 participant