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.

🐛 fix: fix switch skill in home (#11537)

Arvin Xud5561f3b70e8
diff --git a/src/app/[variants]/(main)/home/_layout/HomeAgentIdSync.tsx b/src/app/[variants]/(main)/home/_layout/HomeAgentIdSync.tsx
new file mode 100644
index 00000000000..35bebdd361b
--- /dev/null
+++ b/src/app/[variants]/(main)/home/_layout/HomeAgentIdSync.tsx
@@ -0,0 +1,23 @@
+import { useUnmount } from 'ahooks';
+import { createStoreUpdater } from 'zustand-utils';
+
+import { useAgentStore } from '@/store/agent';
+import { builtinAgentSelectors } from '@/store/agent/selectors';
+
+const HomeAgentIdSync = () => {
+ const useAgentStoreUpdater = createStoreUpdater(useAgentStore);
+
+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
+
+ // Sync inbox agent id to activeAgentId when on home page
+ useAgentStoreUpdater('activeAgentId', inboxAgentId);
+
+ // Clear activeAgentId when unmounting (leaving home page)
+ useUnmount(() => {
+ useAgentStore.setState({ activeAgentId: undefined });
+ });
+
+ return null;
+};
+
+export default HomeAgentIdSync;
diff --git a/src/app/[variants]/(main)/home/_layout/index.tsx b/src/app/[variants]/(main)/home/_layout/index.tsx
index 9ceeeddd203..4b07e2aab15 100644
--- a/src/app/[variants]/(main)/home/_layout/index.tsx
+++ b/src/app/[variants]/(main)/home/_layout/index.tsx
@@ -6,6 +6,7 @@ import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import { useIsDark } from '@/hooks/useIsDark';
import { useHomeStore } from '@/store/home';
+import HomeAgentIdSync from './HomeAgentIdSync';
import RecentHydration from './RecentHydration';
import Sidebar from './Sidebar';
import { styles } from './style';
@@ -56,6 +57,7 @@ const Layout: FC<LayoutProps> = ({ children }) => {
{content}
</Flexbox>
+ <HomeAgentIdSync />
<RecentHydration />
</Flexbox>
</Activity>
diff --git a/src/store/tool/slices/lobehubSkillStore/action.ts b/src/store/tool/slices/lobehubSkillStore/action.ts
index 7c9dcaf8c36..7cbaf09c156 100644
--- a/src/store/tool/slices/lobehubSkillStore/action.ts
+++ b/src/store/tool/slices/lobehubSkillStore/action.ts
@@ -315,11 +315,10 @@ export const createLobehubSkillStoreSlice: StateCreator<
const response = await toolsClient.market.connectListConnections.query();
// Debug logging
- console.log('[useFetchLobehubSkillConnections] raw response:', response);
return response.connections.map((conn: any) => {
// Debug logging for each connection
- console.log('[useFetchLobehubSkillConnections] connection:', conn);
+
// Get provider config from local definition for correct display name
const providerConfig = getLobehubSkillProviderById(conn.providerId);
return {