fix: fetch memo with filter (#346)

This commit is contained in:
boojack
2022-10-27 07:53:40 +08:00
committed by GitHub
parent 9705406b82
commit cb2e1ae355
2 changed files with 11 additions and 1 deletions

View File

@ -103,6 +103,15 @@ const MemoList = () => {
}
}, [query]);
useEffect(() => {
if (isFetching || isComplete) {
return;
}
if (sortedMemos.length < DEFAULT_MEMO_LIMIT) {
handleFetchMoreClick();
}
}, [isFetching, isComplete, query, sortedMemos.length]);
const handleFetchMoreClick = async () => {
try {
const fetchedMemos = await memoService.fetchMemos(DEFAULT_MEMO_LIMIT, memos.length);