Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Jan 16, 2025
1 parent bdbe0e4 commit b3d4928
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
23 changes: 10 additions & 13 deletions src/components/Coaching/CoachingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => (
<CoachingRowWrapper>
<CoachingLoading role="listitem" />
</CoachingRowWrapper>
);

const CoachingListWrapper = styled(Box)(({ theme }) => ({
width: '100%',
Expand All @@ -36,6 +38,9 @@ const CoachingLoading = styled(Skeleton)(() => ({
height: '100px',
}));

interface CoachingListProps {
accountListId: string;
}
export const CoachingList: React.FC<CoachingListProps> = ({
accountListId,
}) => {
Expand All @@ -45,7 +50,7 @@ export const CoachingList: React.FC<CoachingListProps> = ({

const coachingAccounts = data?.coachingAccountLists;

const { loading } = useFetchAllPages({
useFetchAllPages({
fetchMore,
error,
pageInfo: coachingAccounts?.pageInfo,
Expand All @@ -61,7 +66,7 @@ export const CoachingList: React.FC<CoachingListProps> = ({
</CoachingTitleWrapper>
<Divider />
<Box>
{loading ? (
{!data && !error ? (
<>
<LoadingCoach />
<LoadingCoach />
Expand All @@ -84,11 +89,3 @@ export const CoachingList: React.FC<CoachingListProps> = ({
</CoachingListWrapper>
);
};

const LoadingCoach: React.FC = () => (
<span>
<CoachingRowWrapper>
<CoachingLoading role="listitem" />
</CoachingRowWrapper>
</span>
);
6 changes: 0 additions & 6 deletions src/lib/apollo/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit b3d4928

Please sign in to comment.