Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: infinite loop while daily memos more than DEFAULT_MEMO_LIMIT (#1730)

Athurg Gooth5e792236af78
diff --git a/web/src/pages/DailyReview.tsx b/web/src/pages/DailyReview.tsx
index 45a3f07a3..70cabec96 100644
--- a/web/src/pages/DailyReview.tsx
+++ b/web/src/pages/DailyReview.tsx
@@ -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) {