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(VListGroup): support return-object #20595

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

fix(VListGroup): support return-object #20595

wants to merge 13 commits into from

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Oct 19, 2024

Description

fixes #20477

Convert VListGroup.spec.cy.tsx to VListGroup.spec.browser.tsx

Markup:

<template>
  <h1>{{ open }}</h1>
  <v-card class="mx-auto" max-width="300">
    <v-list
      v-model:opened="open"
      :items="items"
      item-value="newValue"
      return-object
    />
  </v-card>
</template>

<script>
  export default {
    data: () => ({
      open: [],
      items: [
        {
          title: 'Item #1',
          newValue: 1,
          children: [
            {
              title: 'Child 1',
              newValue: 100,
            },
          ],
        },
        {
          title: 'Item #2',
          newValue: 2,
        },
        {
          title: 'Item #3',
          newValue: 3,
        },
      ],
    }),
  }
</script>


<template>
  <v-app>
    <v-container>
      <v-treeview :items="items" item-value="id" return-object />
    </v-container>
  </v-app>
</template>

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

  const items = ref([
    {
      id: 1,
      title: 'title 1',
      children: [
        {
          id: 2,
          title: 'title 2',
        },
      ],
    },
  ])
</script>

@yuwu9145 yuwu9145 changed the title fix(VTreeviewChildren): return-object mess up ListGroup id fix(VListGroup): support return-object Oct 20, 2024
@yuwu9145 yuwu9145 marked this pull request as ready for review October 23, 2024 11:11
@yuwu9145 yuwu9145 requested review from KaelWD and johnleider October 23, 2024 11:26
@yuwu9145
Copy link
Member Author

@KaelWD @johnleider Could you briefly check the browser.spec.tsx file being migrated?

johnleider
johnleider previously approved these changes Oct 28, 2024
@MajesticPotatoe MajesticPotatoe added T: bug Functionality that does not work as intended/expected C: VListGroup VListGroup labels Oct 28, 2024
@KaelWD
Copy link
Member

KaelWD commented Oct 29, 2024

I think we need to require a primitive item-value anyway to fix return-object matching performance and #19447.

@yuwu9145
Copy link
Member Author

yuwu9145 commented Oct 30, 2024

I think we need to require a primitive item-value anyway to fix return-object matching performance and #19447.

  • When return-object is applied, the item object must be passed to VListGroup to be able to return the item object to opened.
  • nested composable doesn't have return-object state, so it is unable to do primitive item-value matching and return object. But it fully supports item object used as item id.

primitive item-value is cleaner but atm it requires refactoring nested to internally support return-object.

@yuwu9145 yuwu9145 marked this pull request as draft January 23, 2025 11:45
@yuwu9145 yuwu9145 marked this pull request as ready for review January 23, 2025 12:02
@yuwu9145
Copy link
Member Author

I think we need to require a primitive item-value anyway to fix return-object matching performance and #19447.

@KaelWD If pass primitive item-value, it ends up with three props to be able to get the real "item-key" as well as return the object to v-model:opened, so I came up with a new more straightforward prop "rawId"

image

@johnleider johnleider dismissed their stale review January 23, 2025 13:59

The merge-base changed after approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VListGroup VListGroup T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.7.1] v-treeview class="v-list-group--id-[object Object]" when return-object true
6 participants