mirror of https://github.com/usememos/memos.git
fix: infinite loop while daily memos more than DEFAULT_MEMO_LIMIT (#1730)
Co-authored-by: Athurg Feng <athurg@gooth.org>
This commit is contained in:
parent
45c119627b
commit
5e792236af
|
|
@ -39,9 +39,11 @@ const DailyReview = () => {
|
|||
.sort((a, b) => getTimeStampByDate(a.createdTs) - getTimeStampByDate(b.createdTs));
|
||||
|
||||
useEffect(() => {
|
||||
let offset = 0;
|
||||
const fetchMoreMemos = async () => {
|
||||
try {
|
||||
const fetchedMemos = await memoStore.fetchMemos();
|
||||
const fetchedMemos = await memoStore.fetchMemos(DEFAULT_MEMO_LIMIT, offset);
|
||||
offset += fetchedMemos.length;
|
||||
if (fetchedMemos.length === DEFAULT_MEMO_LIMIT) {
|
||||
const lastMemo = last(fetchedMemos);
|
||||
if (lastMemo && lastMemo.createdTs > currentDateStamp) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue