Skip to content

Commit 2adad3a

Browse files
committed
fix search_value
1 parent c2bf83b commit 2adad3a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

components/dash-core-components/src/fragments/Dropdown.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,25 +375,28 @@ const Dropdown = (props: DropdownProps) => {
375375

376376
// Handle popover open/close
377377
const handleOpenChange = useCallback(
378-
(open: boolean) => {
379-
setIsOpen(open);
378+
(open: boolean) => {
379+
setIsOpen(open);
380380

381+
if (!open) {
381382
const updates: Partial<DropdownProps> = {};
382383

383-
if (!isNil(search_value)) {
384+
if (!isNil(search_value)) {
384385
updates.search_value = undefined;
385386
}
386387

387-
if (!open && debounce && !isEqual(value, val)) {
388+
// Commit debounced value on close only
389+
if (debounce && !isEqual(value, val)) {
388390
updates.value = val;
389391
}
390392

391393
if (Object.keys(updates).length > 0) {
392394
setProps(updates);
393395
}
394-
},
395-
[debounce, value, val, search_value, setProps]
396-
);
396+
}
397+
},
398+
[debounce, value, val, search_value, setProps]
399+
);
397400

398401
const accessibleId = id ?? uuid();
399402
const positioningContainerRef = useRef<HTMLDivElement>(null);

0 commit comments

Comments
 (0)