Skip to content

Commit

Permalink
Merge pull request #210 from DevKor-github/dev
Browse files Browse the repository at this point in the history
hotfix: 무한스크롤 안되는 이슈
  • Loading branch information
halionaz authored Sep 28, 2024
2 parents ab86378 + d6d5de6 commit 219bc6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/rank/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function Rank() {
<Header title="적중률 랭킹" withSideBar={true} />
<MyRank shareHandler={openModal} myRank={myRank} />
<RankList data={rankItems} currentUser={currentUser}>
{!isFetchingNextPage && <div ref={ref} />}
{!isFetchingNextPage && <InfiniteFetchDiv ref={ref} />}
</RankList>
<ScrollToTopButton onClick={() => scrollTo({ left: 0, top: 0, behavior: 'smooth' })}>
<Icon.VerticalAlignTop />
Expand All @@ -72,3 +72,7 @@ const ScrollToTopButton = styled.button`
);
box-shadow: 0px 4px 10px 0px rgba(18, 18, 18, 0.15);
`;

const InfiniteFetchDiv = styled.div`
height: 5px;
`;
1 change: 1 addition & 0 deletions libs/apis/rank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const useGetRankInfiniteScroll = (pageSize: number, queryKey: string) =>
queryFn: fetchRank,
initialPageParam: '' as string,
getNextPageParam: ({ meta: { hasNextData, nextCursor } }) => (hasNextData ? nextCursor : undefined),
retry: 1,
});

return {
Expand Down

0 comments on commit 219bc6c

Please sign in to comment.