feat: Update DropdownSelect component to display selected items based on dropdown option order

- Modified the selection display logic in the DropdownSelect component to show selected items in the order of the dropdown options, rather than the order of user selection.
- This change aims to provide a consistent and predictable user experience, reducing confusion caused by varying display orders.
- Updated the relevant documentation to reflect this new behavior and its rationale.

Made-with: Cursor
This commit is contained in:
2026-03-04 11:08:42 +09:00
parent ec5a980c41
commit a0cf9db6e8
3 changed files with 12 additions and 3 deletions

View File

@@ -127,8 +127,9 @@ const DropdownSelect = forwardRef<HTMLButtonElement, {
}, [value]);
const selectedLabels = useMemo(() => {
return selectedValues
.map((v) => safeOptions.find((o) => o.value === v)?.label)
return safeOptions
.filter((o) => selectedValues.includes(o.value))
.map((o) => o.label)
.filter(Boolean) as string[];
}, [selectedValues, safeOptions]);