AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): fix my agent count in the library (#10357)
Abhimanyu Yadav0b6e46d3638b
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsxindex 766c88169e..7f2c120963 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/LibraryAgentList.tsx@@ -6,6 +6,7 @@ import { useLibraryAgentList } from "./useLibraryAgentList";export default function LibraryAgentList() {const {agentLoading,+ agentCount,allAgents: agents,isFetchingNextPage,isSearching,@@ -18,7 +19,7 @@ export default function LibraryAgentList() {return (<>{/* TODO: We need a new endpoint on backend that returns total number of agents */}- <LibraryActionSubHeader agentCount={agents.length} />+ <LibraryActionSubHeader agentCount={agentCount} /><div className="px-2">{agentLoading ? (<div className="flex h-[200px] items-center justify-center">diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/useLibraryAgentList.ts b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/useLibraryAgentList.tsindex d5d9e41933..0fec814af9 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/useLibraryAgentList.ts+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentList/useLibraryAgentList.ts@@ -56,11 +56,16 @@ export const useLibraryAgentList = () => {return data.agents;}) ?? [];+ const agentCount = agents?.pages[0]+ ? (agents.pages[0].data as LibraryAgentResponse).pagination.total_items+ : 0;+return {allAgents,agentLoading,isFetchingNextPage,hasNextPage,+ agentCount,isSearching: isFetching && !isFetchingNextPage,};};