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:
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user