From ae27fb28d19f5611d23b5926a961e84e01be0002 Mon Sep 17 00:00:00 2001 From: maoyingjie Date: Thu, 29 Oct 2026 16:36:02 +0800 Subject: [PATCH] fix(list-box): preserve typed virtual keys and add HD-09 review repros --- .../vue/src/components/list-box/ListBox.vue | 4 +- tests/fixtures/virtual-rows.vue | 99 ++++++++++++++++++- tests/virtual-rows.test.ts | 39 ++++++++ 3 files changed, 137 insertions(+), 5 deletions(-) diff --git a/packages/vue/src/components/list-box/ListBox.vue b/packages/vue/src/components/list-box/ListBox.vue index 4e92eda..45d5f92 100644 --- a/packages/vue/src/components/list-box/ListBox.vue +++ b/packages/vue/src/components/list-box/ListBox.vue @@ -24,7 +24,7 @@ import { useInheritedDisabled, disabledContextKey } from "../field/disabled"; import { useCollectionSelection } from "../collection/selection"; import { useCollectionRegistry } from "../collection/registry"; import { collectionOwnerKey } from "../collection/owner"; -import { assertKey } from "../collection/keys"; +import { assertKey, encodeKey } from "../collection/keys"; import { listBoxKey, type ListBoxDataItem, @@ -284,7 +284,7 @@ const virtualRows = computed(() => { (typeof props.rowHeight === "function" ? props.rowHeight(index) : props.rowHeight) ?? fallbackRowHeight.value; - push({ key: `item-${item.id}`, kind: "item", height, item, index }); + push({ key: `item-${encodeKey(item.id)}`, kind: "item", height, item, index }); }); if (slots.loader) push({ key: "loader", kind: "loader", height: props.loaderHeight }); diff --git a/tests/fixtures/virtual-rows.vue b/tests/fixtures/virtual-rows.vue index 3b674db..db071bc 100644 --- a/tests/fixtures/virtual-rows.vue +++ b/tests/fixtures/virtual-rows.vue @@ -1,5 +1,13 @@