Skip to content

Commit

Permalink
Merge pull request #68 from DEPthes/jisu
Browse files Browse the repository at this point in the history
Fix 우체통 추가 데이터 로딩 안뜨는 오류 수정
  • Loading branch information
jisupark123 authored Aug 20, 2023
2 parents 91215d2 + 9ba41de commit b0510ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion hooks/queries/useLettersQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function useLettersQuery(params: GetLettersReqParams) {
const {
data: lettersInfiniteData,
isLoading,
isFetching,
isError,
fetchNextPage: getNextLetters,
isSuccess: getLettersIsSuccess,
Expand All @@ -23,5 +24,5 @@ export default function useLettersQuery(params: GetLettersReqParams) {
},
});
const letters = lettersInfiniteData?.pages.map((letter) => letter.data.information.content).flat();
return { letters, isLoading, isError, getNextLetters, getLettersIsSuccess, hasNextPage };
return { letters, isFetching, isError, getNextLetters, getLettersIsSuccess, hasNextPage };
}
5 changes: 3 additions & 2 deletions pages/letter/all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ export default function All() {
const [letterType, setLetterType] = useState<LetterType>('unread');
const {
letters,
isLoading: isLettersLoading,
isFetching: isLettersLoading,
getNextLetters,
getLettersIsSuccess,
hasNextPage,
} = useLettersQuery({ type: letterType, page: 0, size: 20 });

console.log(isLettersLoading);

const [scrollRef, inView] = useInView();

const mailBoxs = letters?.map((letter) => {
Expand Down Expand Up @@ -53,7 +55,6 @@ export default function All() {
});

useEffect(() => {
console.log(hasNextPage);
if (inView && hasNextPage) {
getNextLetters();
}
Expand Down

0 comments on commit b0510ec

Please sign in to comment.