diff --git a/frontend/packages/app/models/accounts.ts b/frontend/packages/app/models/accounts.ts index 2d832d2bd..18011f792 100644 --- a/frontend/packages/app/models/accounts.ts +++ b/frontend/packages/app/models/accounts.ts @@ -6,7 +6,6 @@ import {queryKeys} from '@mintter/app/models/query-keys' import {Account, GRPCClient, Profile} from '@mintter/shared' import { UseMutationOptions, - useInfiniteQuery, useMutation, useQueries, useQuery, @@ -42,19 +41,13 @@ function getAccountQuery(grpcClient: GRPCClient, accountId?: string) { export function useAllAccounts(filterSites?: boolean) { // let isDaemonReady = useDaemonReady() const grpcClient = useGRPCClient() - const accountsQuery = useInfiniteQuery< - {accounts: Array}, - ConnectError - >({ + const contacts = useQuery<{accounts: Array}, ConnectError>({ + // enabled: !!isDaemonReady, queryKey: [queryKeys.GET_ALL_ACCOUNTS, filterSites], - queryFn: async (context) => { - const listed = await grpcClient.accounts.listAccounts({ - pageToken: context.pageParam, - pageSize: 20, - }) + queryFn: async () => { + const listed = await grpcClient.accounts.listAccounts({}) if (filterSites) { return { - ...listed, accounts: listed.accounts.filter( (account) => account.profile?.bio !== 'Hypermedia Site. Powered by Mintter.', @@ -66,21 +59,8 @@ export function useAllAccounts(filterSites?: boolean) { onError: (err) => { appError(`useAllAccounts Error ${err.code}: ${err.message}`, err.metadata) }, - getNextPageParam: (lastPage) => { - return lastPage.nextPageToken || undefined - }, }) - - const allAccounts = - accountsQuery.data?.pages.flatMap((page) => page.accounts) ?? [] - console.log(`== ~ useAllAccounts ~ accountsQuery:`, accountsQuery) - return { - ...accountsQuery, - data: { - ...accountsQuery.data, - accounts: allAccounts, - }, - } + return contacts } export function useSetTrusted(