mirror of
https://github.com/usememos/memos.git
synced 2024-12-18 16:41:44 +03:00
chore: fix loading status
This commit is contained in:
parent
7f7ddf77b8
commit
94c71cb834
@ -82,6 +82,10 @@ const MemoList: React.FC = () => {
|
||||
}
|
||||
}, [filter]);
|
||||
|
||||
useEffect(() => {
|
||||
memoStore.setLoadingStatus("incomplete");
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!fetchMoreRef.current) return;
|
||||
|
||||
|
@ -52,6 +52,10 @@ const Explore = () => {
|
||||
.filter((m) => m.rowStatus === "NORMAL" && m.visibility !== "PRIVATE" && !m.parent)
|
||||
.sort((mi, mj) => mj.displayTs - mi.displayTs);
|
||||
|
||||
useEffect(() => {
|
||||
memoStore.setLoadingStatus("incomplete");
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!fetchMoreRef.current) return;
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { omit } from "lodash-es";
|
||||
import * as api from "@/helpers/api";
|
||||
import { DEFAULT_MEMO_LIMIT } from "@/helpers/consts";
|
||||
import store, { useAppSelector } from "../";
|
||||
import { updateLoadingStatus, createMemo, deleteMemo, patchMemo, upsertMemos } from "../reducer/memo";
|
||||
import { updateLoadingStatus, createMemo, deleteMemo, patchMemo, upsertMemos, LoadingStatus } from "../reducer/memo";
|
||||
import { useMemoCacheStore } from "../v1";
|
||||
|
||||
export const convertResponseModelMemo = (memo: Memo): Memo => {
|
||||
@ -82,6 +82,9 @@ export const useMemoStore = () => {
|
||||
});
|
||||
return archivedMemos;
|
||||
},
|
||||
setLoadingStatus: (status: LoadingStatus) => {
|
||||
store.dispatch(updateLoadingStatus(status));
|
||||
},
|
||||
fetchMemoById,
|
||||
getMemoById: async (memoId: MemoId) => {
|
||||
for (const m of state.memos) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { uniqBy } from "lodash-es";
|
||||
|
||||
type LoadingStatus = "incomplete" | "fetching" | "complete";
|
||||
export type LoadingStatus = "incomplete" | "fetching" | "complete";
|
||||
|
||||
interface State {
|
||||
loadingStatus: LoadingStatus;
|
||||
|
Loading…
Reference in New Issue
Block a user