Skip to content

Commit 17cf360

Browse files
feat: 바뀐 useInfiniteScroll interface 적용
1 parent 1974109 commit 17cf360

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

apps/client/src/pages/jobPins/JobPins.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const JobPins = () => {
1313
const { scrollContainerRef, isBottomNoticeVisible, handleBottomWheel } =
1414
useJobPinsBottomNotice();
1515

16-
const { data, isPending, fetchNextPage, hasNextPage } =
16+
const { data, isPending, fetchNextPage, hasNextPage, isFetchingNextPage } =
1717
useGetJobPinsArticles();
1818
const {
1919
mutate: getJobPinDetail,
@@ -22,9 +22,10 @@ const JobPins = () => {
2222
} = useGetJobPinsArticleDetail();
2323

2424
const observerRef = useInfiniteScroll({
25-
fetchNextPage,
26-
hasNextPage,
27-
root: scrollContainerRef,
25+
loadMore: fetchNextPage,
26+
hasMore: hasNextPage,
27+
isLoadingMore: isFetchingNextPage,
28+
rootRef: scrollContainerRef,
2829
});
2930

3031
const articlesToDisplay =

apps/client/src/pages/myBookmark/hooks/useMyBookmarkContentData.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ export const useMyBookmarkContentData = ({
2727
data: bookmarkArticlesData,
2828
fetchNextPage: fetchNextBookmarkArticles,
2929
hasNextPage: hasNextBookmarkArticles,
30+
isFetchingNextPage: isFetchingNextBookmarkArticles,
3031
} = useGetBookmarkArticles(readStatus);
32+
3133
const { data: bookmarkCountData } = useGetBookmarkArticlesCount();
32-
const { data: categoryCountData } = useGetCategoryBookmarkArticlesCount(
33-
categoryId
34-
);
34+
const { data: categoryCountData } =
35+
useGetCategoryBookmarkArticlesCount(categoryId);
3536

3637
const {
3738
data: categoryArticlesData,
3839
fetchNextPage: fetchNextCategoryArticles,
3940
hasNextPage: hasNextCategoryArticles,
41+
isFetchingNextPage: isFetchingNextCategoryArticles,
4042
} = useGetCategoryBookmarkArticles(categoryId, readStatus);
4143

4244
const categoryList =
@@ -62,14 +64,20 @@ export const useMyBookmarkContentData = ({
6264
const hasNextPage = isCategoryView
6365
? hasNextCategoryArticles
6466
: hasNextBookmarkArticles;
67+
6568
const fetchNextPage = isCategoryView
6669
? fetchNextCategoryArticles
6770
: fetchNextBookmarkArticles;
6871

72+
const isFetchingNextPage = isCategoryView
73+
? isFetchingNextCategoryArticles
74+
: isFetchingNextBookmarkArticles;
75+
6976
const sentinelRef = useInfiniteScroll({
70-
fetchNextPage,
71-
hasNextPage,
72-
root: scrollContainerRef,
77+
loadMore: fetchNextPage,
78+
hasMore: hasNextPage,
79+
isLoadingMore: isFetchingNextPage,
80+
rootRef: scrollContainerRef,
7381
});
7482

7583
return {

apps/client/src/pages/remind/Remind.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ const Remind = () => {
4646
useGetArticleDetail();
4747
const { mutate: updateToReadStatus } = usePutArticleReadStatus();
4848
const { mutate: deleteArticle } = useDeleteRemindArticle();
49-
const { data, isPending, fetchNextPage, hasNextPage } = useGetRemindArticles(
50-
formattedDate,
51-
activeBadge === 'read'
52-
);
49+
const { data, isPending, fetchNextPage, hasNextPage, isFetchingNextPage } =
50+
useGetRemindArticles(formattedDate, activeBadge === 'read');
5351

5452
const observerRef = useInfiniteScroll({
55-
fetchNextPage,
56-
hasNextPage,
57-
root: scrollContainerRef,
53+
loadMore: fetchNextPage,
54+
hasMore: hasNextPage,
55+
isLoadingMore: isFetchingNextPage,
56+
rootRef: scrollContainerRef,
5857
});
5958

6059
const {

0 commit comments

Comments
 (0)