fix(core): flaky tests (#5804)

This commit is contained in:
Peng Xiao
2024-02-06 03:20:54 +00:00
parent afccf3d8c9
commit 005c02f148
4 changed files with 20 additions and 10 deletions

View File

@@ -111,8 +111,7 @@ export class WorkspacePropertiesAdapter {
}
getJournalPageDateString(id: string) {
this.ensurePageProperties(id);
return this.pageProperties[id].system[PageSystemPropertyId.Journal].value;
return this.pageProperties[id]?.system[PageSystemPropertyId.Journal]?.value;
}
setJournalPageDateString(id: string, date: string) {
@@ -127,9 +126,9 @@ export class WorkspacePropertiesAdapter {
// page tags could be reactive
getPageTags(pageId: string) {
this.ensurePageProperties(pageId);
const tags =
this.pageProperties[pageId].system[PageSystemPropertyId.Tags].value;
this.getPageProperties(pageId)?.system[PageSystemPropertyId.Tags].value ??
[];
const optionsMap = Object.fromEntries(this.tagOptions.map(o => [o.id, o]));
return tags.map(tag => optionsMap[tag]).filter((t): t is TagOption => !!t);
}