Skip to content

🤯 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.

chore: use independent swr hook call

rdmclin23626770ccdae
diff --git a/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx b/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx
index 8b0698b9565..f255de08851 100644
--- a/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx
+++ b/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx
@@ -28,11 +28,14 @@ export const IntegrationDetailContent = ({
const [activeTab, setActiveTab] = useState<TabKey>('overview');
// Fetch tools count for Nav badge (always fetch to show count in tab)
- const { data: klavisTools = [] } = useToolStore((s) =>
- s.useFetchServerTools(type === 'klavis' ? serverName : undefined),
+ const useFetchServerTools = useToolStore((s) => s.useFetchServerTools);
+ const useFetchProviderTools = useToolStore((s) => s.useFetchProviderTools);
+
+ const { data: klavisTools = [] } = useFetchServerTools(
+ type === 'klavis' ? serverName : undefined,
);
- const { data: lobehubTools = [] } = useToolStore((s) =>
- s.useFetchProviderTools(type === 'lobehub' ? identifier : undefined),
+ const { data: lobehubTools = [] } = useFetchProviderTools(
+ type === 'lobehub' ? identifier : undefined,
);
const toolsCount = type === 'klavis' ? klavisTools.length : lobehubTools.length;
diff --git a/src/features/IntegrationDetailModal/ToolList.tsx b/src/features/IntegrationDetailModal/ToolList.tsx
index ae2da2867ff..bfb708a5cd0 100644
--- a/src/features/IntegrationDetailModal/ToolList.tsx
+++ b/src/features/IntegrationDetailModal/ToolList.tsx
@@ -22,11 +22,14 @@ const ToolList = memo(() => {
const [activeKey, setActiveKey] = useState<string[]>([]);
// Fetch tools using SWR hooks from store
- const { data: klavisTools = [], isLoading: klavisToolsLoading } = useToolStore((s) =>
- s.useFetchServerTools(type === 'klavis' ? serverName : undefined),
+ const useFetchServerTools = useToolStore((s) => s.useFetchServerTools);
+ const useFetchProviderTools = useToolStore((s) => s.useFetchProviderTools);
+
+ const { data: klavisTools = [], isLoading: klavisToolsLoading } = useFetchServerTools(
+ type === 'klavis' ? serverName : undefined,
);
- const { data: lobehubTools = [], isLoading: lobehubToolsLoading } = useToolStore((s) =>
- s.useFetchProviderTools(type === 'lobehub' ? identifier : undefined),
+ const { data: lobehubTools = [], isLoading: lobehubToolsLoading } = useFetchProviderTools(
+ type === 'lobehub' ? identifier : undefined,
);
const tools: ToolItem[] = type === 'klavis' ? klavisTools : lobehubTools;