Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VTreeview): Incorrect isOpen state in the prepend slot when using return-object #20884

Merged
merged 5 commits into from
Jan 19, 2025

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Jan 18, 2025

fixes #20830

Description

Markup:

<template>
  <h1>{{ opened }}</h1>
  <v-treeview
    item-value="id"
    :items="items"
    return-object
    :value-comparator="compare"
    v-model:selected="selected"
    v-model:opened="opened"
  >
    <template #prepend="{ isOpen }"> [{{isOpen}}] </template>
    <template #append="{ isOpen }"> [{{isOpen}}] </template>
  </v-treeview>
</template>

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

  function compare(a, b) {
    console.log(a, b)
    return a.id === b.id
  }

  const selected = ref([])
  const opened = ref([])

  watch(selected, v => {
    console.log('selected', v)
  })

  const items = ref([
  {
    id: 1,
    title: 'Vuetify Human Resources',
    children: [
      {
        id: 2,
        title: 'Core team',
        children: [
          {
            id: 201,
            title: 'John',
          },
        ],
      },
    ],
  },
])
</script>

@yuwu9145
Copy link
Member Author

yuwu9145 commented Jan 18, 2025

Need more work to prevent regression on #20354

@yuwu9145 yuwu9145 marked this pull request as ready for review January 19, 2025 00:14
@yuwu9145 yuwu9145 changed the title fix(VTreeview): wrong isOpen state in prepend slot fix(VTreeview): Incorrect isOpen state in the prepend slot when using return-object Jan 19, 2025
@yuwu9145 yuwu9145 merged commit 14be656 into master Jan 19, 2025
18 checks passed
@yuwu9145 yuwu9145 deleted the fix-20830 branch January 19, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant