From d114485abddde0460fa266b5ed0c2422515dd173 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 27 Jun 2025 10:10:02 +0800 Subject: [PATCH] feat: pluging loading --- .../auto-update-setting/tool-picker.tsx | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx index 0c3fa83cf0..d8375f6aec 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx @@ -12,6 +12,7 @@ import SearchBox from '@/app/components/plugins/marketplace/search-box' import { useTranslation } from 'react-i18next' import cn from '@/utils/classnames' import ToolItem from './tool-item' +import Loading from '@/app/components/base/loading' type Props = { trigger: React.ReactNode @@ -64,7 +65,7 @@ const ToolPicker: FC = ({ const [pluginType, setPluginType] = useState(PLUGIN_TYPE_SEARCH_MAP.all) const [query, setQuery] = useState('') const [tags, setTags] = useState([]) - const { data } = useFetchPluginListOrBundleList({ + const { data, isLoading } = useFetchPluginListOrBundleList({ query, tags, category: pluginType, @@ -79,6 +80,26 @@ const ToolPicker: FC = ({ onChange(newValue) } }, [onChange, value]) + + const listContent = ( +
+ {list.map(item => ( + + ))} +
+ ) + + const loadingContent = ( +
+ +
+ ) + return ( = ({ } - {list.length > 0 && ( -
- {list.map(item => ( - - ))} -
- )} + {!isLoading && list.length > 0 && listContent} + {isLoading && loadingContent}
) } + export default React.memo(ToolPicker)