Skip to content

Commit 6781e0c

Browse files
fix: mismatch of array data in single mode (meant to be multiple)
1 parent b9d2cf5 commit 6781e0c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/kit-headless/src/components/select/select-root.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export const SelectImpl = component$<SelectProps<boolean> & InternalSelectProps>
192192
track(() => bindValueSig.value);
193193

194194
for (const [index, item] of itemsMapSig.value) {
195-
if (bindValueSig.value.includes(item.value)) {
195+
if (bindValueSig.value?.includes(item.value)) {
196196
await selectionManager$(index, 'add');
197197

198198
if (initialLoadSig.value) {
@@ -256,7 +256,11 @@ export const SelectImpl = component$<SelectProps<boolean> & InternalSelectProps>
256256
const newUserSigValues = JSON.stringify(values);
257257

258258
if (currUserSigValues !== newUserSigValues) {
259-
bindValueSig.value = values;
259+
if (context.multiple) {
260+
bindValueSig.value = values;
261+
} else {
262+
bindValueSig.value = values[0];
263+
}
260264
}
261265
}
262266

0 commit comments

Comments
 (0)