From 052413e4ae6a2a69b0a9920726695cc4e6d6c015 Mon Sep 17 00:00:00 2001 From: Davide Bizzi Date: Thu, 24 Oct 2024 13:29:10 +0200 Subject: [PATCH] fix: Update options on propchange --- src/stories/dropdowns/autocomplete/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stories/dropdowns/autocomplete/index.tsx b/src/stories/dropdowns/autocomplete/index.tsx index cd0deb5e..b69aecd5 100644 --- a/src/stories/dropdowns/autocomplete/index.tsx +++ b/src/stories/dropdowns/autocomplete/index.tsx @@ -6,7 +6,7 @@ import { Option, OptionValue, } from "@zendeskgarden/react-dropdowns.next"; -import { useCallback, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; import useDebounce from "../../../hooks/useDebounce"; import { OptGroup } from "../optGroup"; @@ -80,6 +80,8 @@ const Autocomplete = ({ const [_options, setOption] = useState(options); const debouncedInputValue = useDebounce(inputValue, 300); + useEffect(() => setOption(options), [options]); + // update options isHidden property based on inputValue const matchingOptions = useMemo( () =>