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

* fix switch skill in home

* clean
This commit is contained in:
Arvin Xu
2026-01-16 22:16:33 +08:00
committed by GitHub
parent 67bb9f64aa
commit d5561f3b70
3 changed files with 26 additions and 2 deletions

View File

@@ -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;

View File

@@ -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>

View File

@@ -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 {