🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(plugin-store): fix search functionality for old plugin store (#9651)
Shinji-Li522fc09a858c
diff --git a/src/features/PluginStore/PluginList/List/index.tsx b/src/features/PluginStore/PluginList/List/index.tsxindex e0c6a00a02b..091c849a447 100644--- a/src/features/PluginStore/PluginList/List/index.tsx+++ b/src/features/PluginStore/PluginList/List/index.tsx@@ -1,7 +1,7 @@import { Icon } from '@lobehub/ui';import { Empty } from 'antd';import { ServerCrash } from 'lucide-react';-import { memo } from 'react';+import { memo, useEffect } from 'react';import { useTranslation } from 'react-i18next';import { Center, Flexbox } from 'react-layout-kit';import { Virtuoso } from 'react-virtuoso';@@ -25,6 +25,7 @@ export const List = memo(() => {searchLoading,useFetchPluginList,loadMorePlugins,+ resetPluginList,] = useToolStore((s) => [s.isPluginListInit,s.activePluginIdentifier,@@ -35,8 +36,14 @@ export const List = memo(() => {s.pluginSearchLoading,s.useFetchPluginList,s.loadMorePlugins,+ s.resetPluginList,]);+ // 当 keywords 变化时重置列表+ useEffect(() => {+ resetPluginList(keywords);+ }, [keywords, resetPluginList]);+const { isLoading, error } = useFetchPluginList({page: currentPage,pageSize: 20,diff --git a/src/features/PluginStore/Search/index.tsx b/src/features/PluginStore/Search/index.tsxindex 669d9c4b4b8..99ab8a2ffe4 100644--- a/src/features/PluginStore/Search/index.tsx+++ b/src/features/PluginStore/Search/index.tsx@@ -4,10 +4,18 @@ import { useTranslation } from 'react-i18next';import { Flexbox } from 'react-layout-kit';import { useToolStore } from '@/store/tool';+import { PluginStoreTabs } from '@/store/tool/slices/oldStore';export const Search = memo(() => {const { t } = useTranslation('plugin');- const [keywords] = useToolStore((s) => [s.mcpSearchKeywords]);+ const [listType, mcpKeywords, pluginKeywords] = useToolStore((s) => [+ s.listType,+ s.mcpSearchKeywords,+ s.pluginSearchKeywords,+ ]);++ // 根据当前选项卡决定使用哪个关键词+ const keywords = listType === PluginStoreTabs.MCP ? mcpKeywords : pluginKeywords;return (<Flexbox align={'center'} gap={8} horizontal justify={'space-between'}>@@ -16,7 +24,11 @@ export const Search = memo(() => {allowCleardefaultValue={keywords}onSearch={(keywords: string) => {- useToolStore.setState({ mcpSearchKeywords: keywords, searchLoading: true });+ if (listType === PluginStoreTabs.MCP) {+ useToolStore.setState({ mcpSearchKeywords: keywords, searchLoading: true });+ } else if (listType === PluginStoreTabs.Plugin) {+ useToolStore.setState({ pluginSearchKeywords: keywords, pluginSearchLoading: true });+ }}}placeholder={t('store.placeholder')}variant={'borderless'}