Skip to content

Commit 884a766

Browse files
ryo-manbareidbarberyihuiliao
authored
Fix timer cleanup on ComboBox unmount (#6072)
* Fix timer cleanup on ComboBox unmount * Fix: Ensure proper timer cleanup in ComboBox on unmount --------- Co-authored-by: Reid Barber <reid@reidbarber.com> Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com>
1 parent 809b5f7 commit 884a766

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/@react-spectrum/combobox/src/ComboBox.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ const ComboBoxInput = React.forwardRef(function ComboBoxInput(props: ComboBoxInp
278278
lastInputValue.current = inputValue;
279279
}, [isLoading, showLoading, inputValue]);
280280

281+
useEffect(() => {
282+
return () => {
283+
clearTimeout(timeout.current);
284+
timeout.current = null;
285+
};
286+
}, []);
287+
281288
return (
282289
<FocusRing
283290
within

0 commit comments

Comments
 (0)