Skip to content

Commit

Permalink
fix: 친구목록 조회 무한 스크롤 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeseon-han committed Feb 23, 2024
1 parent 2a4c9ad commit 2b342e6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/templates/FriendListTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({
const [selectedFriendIds, setSelectedFriendIds] = useState<number[]>([]);
const {
data: friendsData,
fetchNextPage: friendsNextPage,
fetchNextPage: fetchFriendsNextPage,
isFetchingNextPage: isFetchingfriendsNextPage,
refetch: friendsRefetch,
} = useGetFriendships({
Expand All @@ -53,7 +53,7 @@ const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({

const onIntersect: IntersectionObserverCallback = ([entry]) => {
if (entry.isIntersecting) {
void friendsNextPage();
void fetchFriendsNextPage();
}
};

Expand Down Expand Up @@ -116,10 +116,13 @@ const FriendListTemplate: React.FC<{ possibleDelete: boolean }> = ({
/>
)),
)}
{isFetchingfriendsNextPage ? (
<SuspenseFallback />
) : (
<div ref={bottom} />
)}
</div>

{isFetchingfriendsNextPage ? <SuspenseFallback /> : <div ref={bottom} />}

<div className="fixed w-screen max-w-[480px] bottom-0 px-[20px] py-[26px]">
<Button
text={'삭제하기'}
Expand Down

0 comments on commit 2b342e6

Please sign in to comment.