mirror of
https://github.com/usememos/memos.git
synced 2025-03-18 11:40:09 +01:00
fix: optimize memoMap generation logic to ensure memoMap count matche… (#4214)
fix: optimize memoMap generation logic to ensure memoMap count matches memos
This commit is contained in:
parent
7a77b4ba38
commit
f15346e615
@ -41,10 +41,13 @@ export const useMemoMetadataStore = create(
|
||||
view: MemoView.MEMO_VIEW_METADATA_ONLY,
|
||||
pageSize: DEFAULT_MEMO_PAGE_SIZE,
|
||||
});
|
||||
const memoMap = { ...get().dataMapByName };
|
||||
for (const memo of memos) {
|
||||
memoMap[memo.name] = memo;
|
||||
}
|
||||
const memoMap = memos.reduce<Record<string, Memo>>(
|
||||
(acc, memo) => ({
|
||||
...acc,
|
||||
[memo.name]: memo,
|
||||
}),
|
||||
{},
|
||||
);
|
||||
set({ stateId: uniqueId(), dataMapByName: memoMap });
|
||||
return { memos, nextPageToken };
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user