Skip to content

Commit facd4af

Browse files
authored
fix(group): support null values (#21743)
1 parent 1bbcb09 commit facd4af

File tree

1 file changed

+5
-5
lines changed
  • packages/vuetify/src/composables

1 file changed

+5
-5
lines changed

packages/vuetify/src/composables/group.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ export function useGroup (
169169
'modelValue',
170170
[],
171171
v => {
172-
if (v == null) return []
172+
if (v === undefined) return []
173173

174-
return getIds(items, wrapInArray(v))
174+
return getIds(items, v === null ? [null] : wrapInArray(v))
175175
},
176176
v => {
177177
const arr = getValues(items, v)
@@ -190,7 +190,7 @@ export function useGroup (
190190
const children = findChildrenWithProvide(key, groupVm?.vnode)
191191
const index = children.indexOf(vm)
192192

193-
if (unref(unwrapped.value) == null) {
193+
if (unref(unwrapped.value) === undefined) {
194194
unwrapped.value = index
195195
unwrapped.useIndexAsValue = true
196196
}
@@ -339,7 +339,7 @@ function getIds (items: UnwrapRef<GroupItem[]>, modelValue: any[]) {
339339
const item = items.find(item => deepEqual(value, item.value))
340340
const itemByIndex = items[value]
341341

342-
if (item?.value != null) {
342+
if (item?.value !== undefined) {
343343
ids.push(item.id)
344344
} else if (itemByIndex?.useIndexAsValue) {
345345
ids.push(itemByIndex.id)
@@ -356,7 +356,7 @@ function getValues (items: UnwrapRef<GroupItem[]>, ids: any[]) {
356356
const itemIndex = items.findIndex(item => item.id === id)
357357
if (~itemIndex) {
358358
const item = items[itemIndex]
359-
values.push(item.value != null ? item.value : itemIndex)
359+
values.push(item.value !== undefined ? item.value : itemIndex)
360360
}
361361
})
362362

0 commit comments

Comments
 (0)