Skip to content

Commit 8ba0b30

Browse files
fix: initialize MultiSelectCombobox with value prop
Ensures that when using the value prop (controlled mode), the component properly initializes with the provided selected options on first render. Co-authored-by: jaaydenh <1858163+jaaydenh@users.noreply.github.com>
1 parent 0a17d51 commit 8ba0b30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export const MultiSelectCombobox = forwardRef<
215215
const dropdownRef = useRef<HTMLDivElement>(null);
216216

217217
const [selected, setSelected] = useState<Option[]>(
218-
arrayDefaultOptions ?? [],
218+
value ?? arrayDefaultOptions ?? [],
219219
);
220220
const [options, setOptions] = useState<GroupOption>(
221221
transitionToGroupOption(arrayDefaultOptions, groupBy),

0 commit comments

Comments
 (0)