🤯 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:fixed when plugins unistall & install both take problem (#9296)
Shinji-Li2e928cd5873c
diff --git a/src/features/PluginStore/InstalledList/List/Item/Action.tsx b/src/features/PluginStore/InstalledList/List/Item/Action.tsxindex 6cac0839cec..42d3a6e9197 100644--- a/src/features/PluginStore/InstalledList/List/Item/Action.tsx+++ b/src/features/PluginStore/InstalledList/List/Item/Action.tsx@@ -7,6 +7,7 @@ import { Flexbox } from 'react-layout-kit';import PluginDetailModal from '@/features/PluginDetailModal';import { useAgentStore } from '@/store/agent';+import { agentSelectors } from '@/store/agent/selectors';import { useServerConfigStore } from '@/store/serverConfig';import { pluginHelpers, useToolStore } from '@/store/tool';import { pluginSelectors, pluginStoreSelectors } from '@/store/tool/selectors';@@ -36,7 +37,10 @@ const Actions = memo<ActionsProps>(({ identifier, type, isMCP }) => {const { t } = useTranslation('plugin');const [open, setOpen] = useState(false);const plugin = useToolStore(pluginSelectors.getToolManifestById(identifier));- const togglePlugin = useAgentStore((s) => s.togglePlugin);+ const [togglePlugin, isPluginEnabledInAgent] = useAgentStore((s) => [+ s.togglePlugin,+ agentSelectors.currentAgentPlugins(s).includes(identifier),+ ]);const { modal } = App.useApp();const [tab, setTab] = useState('info');const hasSettings = pluginHelpers.isSettingSchemaNonEmpty(plugin?.settings);@@ -90,7 +94,13 @@ const Actions = memo<ActionsProps>(({ identifier, type, isMCP }) => {modal.confirm({centered: true,okButtonProps: { danger: true },- onOk: async () => unInstallPlugin(identifier),+ onOk: async () => {+ // If plugin is enabled in current agent, disable it first+ if (isPluginEnabledInAgent) {+ await togglePlugin(identifier, false);+ }+ await unInstallPlugin(identifier);+ },title: t('store.actions.confirmUninstall'),type: 'error',});diff --git a/src/features/PluginStore/McpList/List/Action.tsx b/src/features/PluginStore/McpList/List/Action.tsxindex a5ec772b49d..8edaa2d4e25 100644--- a/src/features/PluginStore/McpList/List/Action.tsx+++ b/src/features/PluginStore/McpList/List/Action.tsx@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';import { Flexbox } from 'react-layout-kit';import { useAgentStore } from '@/store/agent';+import { agentSelectors } from '@/store/agent/selectors';import { useToolStore } from '@/store/tool';import { mcpStoreSelectors, pluginSelectors } from '@/store/tool/selectors';@@ -24,7 +25,10 @@ const Actions = memo<ActionsProps>(({ identifier }) => {]);const { t } = useTranslation('plugin');- const togglePlugin = useAgentStore((s) => s.togglePlugin);+ const [togglePlugin, isPluginEnabledInAgent] = useAgentStore((s) => [+ s.togglePlugin,+ agentSelectors.currentAgentPlugins(s).includes(identifier),+ ]);const { modal } = App.useApp();return (@@ -42,7 +46,13 @@ const Actions = memo<ActionsProps>(({ identifier }) => {modal.confirm({centered: true,okButtonProps: { danger: true },- onOk: async () => unInstallPlugin(identifier),+ onOk: async () => {+ // If plugin is enabled in current agent, disable it first+ if (isPluginEnabledInAgent) {+ await togglePlugin(identifier, false);+ }+ await unInstallPlugin(identifier);+ },title: t('store.actions.confirmUninstall'),type: 'error',});diff --git a/src/features/PluginStore/PluginList/List/Action.tsx b/src/features/PluginStore/PluginList/List/Action.tsxindex 97a3e5cc6ba..7db865b5b4f 100644--- a/src/features/PluginStore/PluginList/List/Action.tsx+++ b/src/features/PluginStore/PluginList/List/Action.tsx@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';import { Flexbox } from 'react-layout-kit';import { useAgentStore } from '@/store/agent';+import { agentSelectors } from '@/store/agent/selectors';import { useToolStore } from '@/store/tool';import { pluginSelectors, pluginStoreSelectors } from '@/store/tool/selectors';@@ -22,7 +23,10 @@ const Actions = memo<ActionsProps>(({ identifier }) => {]);const { t } = useTranslation('plugin');- const togglePlugin = useAgentStore((s) => s.togglePlugin);+ const [togglePlugin, isPluginEnabledInAgent] = useAgentStore((s) => [+ s.togglePlugin,+ agentSelectors.currentAgentPlugins(s).includes(identifier),+ ]);const { modal } = App.useApp();return (@@ -40,7 +44,13 @@ const Actions = memo<ActionsProps>(({ identifier }) => {modal.confirm({centered: true,okButtonProps: { danger: true },- onOk: async () => unInstallPlugin(identifier),+ onOk: async () => {+ // If plugin is enabled in current agent, disable it first+ if (isPluginEnabledInAgent) {+ await togglePlugin(identifier, false);+ }+ await unInstallPlugin(identifier);+ },title: t('store.actions.confirmUninstall'),type: 'error',});