From b3d492854aac0cc244668c96927cac6af746c906 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Thu, 16 Jan 2025 14:24:02 -0500 Subject: [PATCH] improvements --- src/components/Coaching/CoachingList.tsx | 23 ++++++++++------------- src/lib/apollo/cache.ts | 6 ------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/components/Coaching/CoachingList.tsx b/src/components/Coaching/CoachingList.tsx index 4646b16c4..d8237727a 100644 --- a/src/components/Coaching/CoachingList.tsx +++ b/src/components/Coaching/CoachingList.tsx @@ -7,9 +7,11 @@ import { useFetchAllPages } from 'src/hooks/useFetchAllPages'; import { CoachingRow, CoachingRowWrapper } from './CoachingRow/CoachingRow'; import { useLoadCoachingListQuery } from './LoadCoachingList.generated'; -interface CoachingListProps { - accountListId: string; -} +const LoadingCoach: React.FC = () => ( + + + +); const CoachingListWrapper = styled(Box)(({ theme }) => ({ width: '100%', @@ -36,6 +38,9 @@ const CoachingLoading = styled(Skeleton)(() => ({ height: '100px', })); +interface CoachingListProps { + accountListId: string; +} export const CoachingList: React.FC = ({ accountListId, }) => { @@ -45,7 +50,7 @@ export const CoachingList: React.FC = ({ const coachingAccounts = data?.coachingAccountLists; - const { loading } = useFetchAllPages({ + useFetchAllPages({ fetchMore, error, pageInfo: coachingAccounts?.pageInfo, @@ -61,7 +66,7 @@ export const CoachingList: React.FC = ({ - {loading ? ( + {!data && !error ? ( <> @@ -84,11 +89,3 @@ export const CoachingList: React.FC = ({ ); }; - -const LoadingCoach: React.FC = () => ( - - - - - -); diff --git a/src/lib/apollo/cache.ts b/src/lib/apollo/cache.ts index 96ae1972f..015b10f24 100644 --- a/src/lib/apollo/cache.ts +++ b/src/lib/apollo/cache.ts @@ -42,12 +42,6 @@ export const createCache = () => }, merge: true, }, - CoachingAccountLists: { - fields: { - contacts: paginationFieldPolicy, - }, - merge: true, - }, // For Options, use the key as the unique id to make it easier to find them in the cache Option: { keyFields: ['key'] }, User: { merge: true },