Skip to content

Commit

Permalink
fix: memo view
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Oct 6, 2024
1 parent d11e7a3 commit 0b2f08a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { memoServiceClient } from "@/grpcweb";
import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts";
import useCurrentUser from "@/hooks/useCurrentUser";
import { MemoRelation_Type } from "@/types/proto/api/v1/memo_relation_service";
import { Memo } from "@/types/proto/api/v1/memo_service";
import { Memo, MemoView } from "@/types/proto/api/v1/memo_service";
import { useTranslate } from "@/utils/i18n";
import { EditorRefActions } from "../Editor";
import { MemoEditorContext } from "../types";
Expand Down Expand Up @@ -50,6 +50,7 @@ const AddMemoRelationPopover = (props: Props) => {
const { memos } = await memoServiceClient.listMemos({
pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE,
filter: filters.length > 0 ? filters.join(" && ") : undefined,
view: MemoView.MEMO_VIEW_FULL,
});
setFetchedMemos(memos);
} catch (error: any) {
Expand Down
7 changes: 5 additions & 2 deletions web/src/store/v1/memo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { uniqueId } from "lodash-es";
import { create } from "zustand";
import { combine } from "zustand/middleware";
import { memoServiceClient } from "@/grpcweb";
import { CreateMemoRequest, ListMemosRequest, Memo } from "@/types/proto/api/v1/memo_service";
import { CreateMemoRequest, ListMemosRequest, Memo, MemoView } from "@/types/proto/api/v1/memo_service";

interface State {
// stateId is used to identify the store instance state.
Expand All @@ -21,7 +21,10 @@ export const useMemoStore = create(
setState: (state: State) => set(state),
getState: () => get(),
fetchMemos: async (request: Partial<ListMemosRequest>) => {
const { memos, nextPageToken } = await memoServiceClient.listMemos(request);
const { memos, nextPageToken } = await memoServiceClient.listMemos({
...request,
view: MemoView.MEMO_VIEW_FULL,
});
const memoMap = { ...get().memoMapByName };
for (const memo of memos) {
memoMap[memo.name] = memo;
Expand Down

0 comments on commit 0b2f08a

Please sign in to comment.