mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(core): fix meta.xxx is undefined (#6321)
This commit is contained in:
@@ -155,7 +155,7 @@ export const CMDKContainer = ({
|
||||
open: boolean;
|
||||
className?: string;
|
||||
query: string;
|
||||
pageMeta?: DocMeta;
|
||||
pageMeta?: Partial<DocMeta>;
|
||||
groups: ReturnType<typeof useCMDKCommandGroups>;
|
||||
onQueryChange: (query: string) => void;
|
||||
}>) => {
|
||||
@@ -234,7 +234,7 @@ const CMDKQuickSearchModalInner = ({
|
||||
pageMeta,
|
||||
open,
|
||||
...props
|
||||
}: CMDKModalProps & { pageMeta?: DocMeta }) => {
|
||||
}: CMDKModalProps & { pageMeta?: Partial<DocMeta> }) => {
|
||||
const [query, setQuery] = useAtom(cmdkQueryAtom);
|
||||
useLayoutEffect(() => {
|
||||
if (open) {
|
||||
@@ -260,7 +260,7 @@ export const CMDKQuickSearchModal = ({
|
||||
pageMeta,
|
||||
open,
|
||||
...props
|
||||
}: CMDKModalProps & { pageMeta?: DocMeta }) => {
|
||||
}: CMDKModalProps & { pageMeta?: Partial<DocMeta> }) => {
|
||||
return (
|
||||
<CMDKModal open={open} {...props}>
|
||||
<Suspense fallback={<Command.Loading />}>
|
||||
|
||||
@@ -316,7 +316,7 @@ const ConflictList = ({
|
||||
setTrashModal({
|
||||
open: true,
|
||||
pageIds: [pageRecord.id],
|
||||
pageTitles: [pageRecord.meta$.value.title],
|
||||
pageTitles: [pageRecord.title$.value],
|
||||
});
|
||||
},
|
||||
[setTrashModal]
|
||||
|
||||
@@ -50,7 +50,7 @@ export class Tag {
|
||||
return;
|
||||
}
|
||||
pageRecord?.setMeta({
|
||||
tags: [...pageRecord.meta$.value.tags, this.id],
|
||||
tags: [...(pageRecord.meta$.value.tags ?? []), this.id],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,14 +60,14 @@ export class Tag {
|
||||
return;
|
||||
}
|
||||
pageRecord?.setMeta({
|
||||
tags: pageRecord.meta$.value.tags.filter(tagId => tagId !== this.id),
|
||||
tags: pageRecord.meta$.value.tags?.filter(tagId => tagId !== this.id),
|
||||
});
|
||||
}
|
||||
|
||||
readonly pageIds$ = LiveData.computed(get => {
|
||||
const pages = get(this.pageRecordList.records$);
|
||||
return pages
|
||||
.filter(page => get(page.meta$).tags.includes(this.id))
|
||||
.filter(page => get(page.meta$).tags?.includes(this.id))
|
||||
.map(page => page.id);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export class TagService {
|
||||
if (!pageRecord) return [];
|
||||
const tagIds = get(pageRecord.meta$).tags;
|
||||
|
||||
return get(this.tags$).filter(tag => tagIds.includes(tag.id));
|
||||
return get(this.tags$).filter(tag => (tagIds ?? []).includes(tag.id));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
||||
|
||||
const updatedDate = linkedPage.meta$.value.updatedDate;
|
||||
const createDate = linkedPage.meta$.value.createDate;
|
||||
return updatedDate ? new Date(updatedDate) : new Date(createDate);
|
||||
return new Date(updatedDate || createDate || Date.now());
|
||||
};
|
||||
|
||||
page.setMode(mode);
|
||||
|
||||
Reference in New Issue
Block a user