diff --git a/src/components/SearchInput.jsx b/src/components/SearchInput.jsx index a30bcfa..62d1ca5 100644 --- a/src/components/SearchInput.jsx +++ b/src/components/SearchInput.jsx @@ -13,7 +13,7 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false, if (initLoad && defaultOptions.length===0) { loadOptions(' '); } - }, [initLoad]); + }, [initLoad, defaultOptions]); const loadOptions = (value) => { fetchRef.current += 1; @@ -50,13 +50,8 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false, onSearch={debounceFetcher} notFoundContent={fetching ? : null} optionFilterProp='label' - > - {options.map((d) => ( - - {d.label} - - ))} - + options={options} + /> ); } diff --git a/src/components/VendorSelector.jsx b/src/components/VendorSelector.jsx index 2e7b643..dfb75f5 100644 --- a/src/components/VendorSelector.jsx +++ b/src/components/VendorSelector.jsx @@ -20,12 +20,13 @@ const VendorSelector = ({ ...props }) => { const { travelAgencyId: myAgencyId } = usingStorage(); const [{ travelAgencyName: myAgencyName }] = useAuthStore((state) => [state.currentUser]); const { t } = useTranslation(); - const [{ vendorList }, setCache] = useFormStore(state => [state.cache, state.setCache]); + const [{ vendorList }, setCache] = useFormStore(state => [state.cache, state.setCache]); return ( <> { const { t } = useTranslation(); const { message } = App.useApp(); @@ -22,6 +38,8 @@ const Edit = ({ ...props }) => { const [form] = Form.useForm(); const clickedButton = useRef(''); const quillRef = useRef(); + const setCache = useFormStore(state => state.setCache); + const [showAgencySelector, setShowAgencySelector] = useState(1); const [showAgencySeleted, setShowAgencySeleted] = useState(0); @@ -45,7 +63,10 @@ const Edit = ({ ...props }) => { form.setFieldsValue({ agency_list: _list, }); + setCache({ vendorList: _list }) }); + } else { + setCache({ vendorList: allOverseasAgency }) } }, []);