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