From 2b5c35b8374c13c87b9c6ee41d493249b376c0ab Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 13 Nov 2025 11:23:04 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BE=9B=E5=BA=94=E5=95=86=E9=80=89?= =?UTF-8?q?=E6=8B=A9:=20=E9=BB=98=E8=AE=A4=E9=80=89=E9=A1=B9=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchInput.jsx | 11 +++-------- src/components/VendorSelector.jsx | 3 ++- src/views/notifs/Edit.jsx | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) 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 }) } }, []);