mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
🐛 fix: fix switch skill in home (#11537)
* fix switch skill in home * clean
This commit is contained in:
23
src/app/[variants]/(main)/home/_layout/HomeAgentIdSync.tsx
Normal file
23
src/app/[variants]/(main)/home/_layout/HomeAgentIdSync.tsx
Normal 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;
|
||||
@@ -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>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user