diff --git a/src/containers/category-dropdown/CategoryDropdown.tsx b/src/containers/category-dropdown/CategoryDropdown.tsx index 63eae08a0..5a45e46f0 100644 --- a/src/containers/category-dropdown/CategoryDropdown.tsx +++ b/src/containers/category-dropdown/CategoryDropdown.tsx @@ -42,6 +42,7 @@ const CategoryDropdown = ({ const { setAlert } = useSnackBarContext() const { openModal, closeModal } = useModalContext() const [isFetched, setIsFetched] = useState(false) + const [isFetchedOnFocus, setIsFetchedOnFocus] = useState(false) const handleResponseError = (error: ErrorResponse) => { setAlert({ @@ -52,6 +53,7 @@ const CategoryDropdown = ({ const getCategories = useCallback(() => { setIsFetched(true) + setIsFetchedOnFocus(true) return ResourceService.getResourcesCategoriesNames() }, [setIsFetched]) @@ -130,7 +132,7 @@ const CategoryDropdown = ({ fetchCondition={!isFetched} - fetchOnFocus + fetchOnFocus={isFetchedOnFocus} labelField='name' onChange={onCategoryChange} renderOption={(props, option, state) =>