Skip to content

Build your personal knowledge base with Trilium Notes

test(script-deployer): fix failing test due to non-refreshed cache

Elian Doran0077b3585482
diff --git a/apps/script-deployer/src/deploy.spec.ts b/apps/script-deployer/src/deploy.spec.ts
index 0a156748c8..5166615810 100644
--- a/apps/script-deployer/src/deploy.spec.ts
+++ b/apps/script-deployer/src/deploy.spec.ts
@@ -21,6 +21,7 @@ vi.mock("@triliumnext/server/src/services/sql", () => ({
execute: () => {},
replace: () => {},
getMap: () => {},
+ getValue: () => null,
},
}));
diff --git a/apps/script-deployer/src/deploy.ts b/apps/script-deployer/src/deploy.ts
index 71541e5112..4853cf2791 100644
--- a/apps/script-deployer/src/deploy.ts
+++ b/apps/script-deployer/src/deploy.ts
@@ -136,6 +136,7 @@ export interface BeccaLike {
setContent(content: string): void;
setRelation(name: string, targetNoteId: string): void;
setLabel(name: string, value?: string): void;
+ invalidateThisCache(): void;
}>;
}
@@ -157,6 +158,9 @@ function applyLabels(note: BeccaLike["notes"][string], meta: ScriptMeta) {
note.setLabel(label, meta[label]);
}
}
+ // BNote caches attributes eagerly during setLabel's save() path.
+ // Invalidate so subsequent reads see all labels we just set.
+ note.invalidateThisCache();
}
/**