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: fetch memo with filter (#346)

boojackcb2e1ae3558a
diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx
index e29b2f92a..76e70de7c 100644
--- a/web/src/components/MemoList.tsx
+++ b/web/src/components/MemoList.tsx
@@ -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);
diff --git a/web/src/store/modules/location.ts b/web/src/store/modules/location.ts
index 7130f190c..dabd4dd6b 100644
--- a/web/src/store/modules/location.ts
+++ b/web/src/store/modules/location.ts
@@ -42,7 +42,8 @@ const getStateFromLocation = () => {
state.query.tag = urlParams.get("tag") ?? undefined;
state.query.type = (urlParams.get("type") as MemoSpecType) ?? undefined;
state.query.text = urlParams.get("text") ?? undefined;
- state.query.shortcutId = Number(urlParams.get("shortcutId")) ?? undefined;
+ const shortcutIdStr = urlParams.get("shortcutId");
+ state.query.shortcutId = shortcutIdStr ? Number(shortcutIdStr) : undefined;
const from = parseInt(urlParams.get("from") ?? "0");
const to = parseInt(urlParams.get("to") ?? "0");
if (to > from && to !== 0) {