Skip to content

Build your personal knowledge base with Trilium Notes

fix(standalone): cls mismatch compared to server when empty

Elian Doranaf045dcfb2b5
diff --git a/apps/client-standalone/src/lightweight/cls_provider.ts b/apps/client-standalone/src/lightweight/cls_provider.ts
index 08d1a24d7b..d4336967db 100644
--- a/apps/client-standalone/src/lightweight/cls_provider.ts
+++ b/apps/client-standalone/src/lightweight/cls_provider.ts
@@ -18,8 +18,11 @@ export default class BrowserExecutionContext implements ExecutionContext {
return this.contextStack[this.contextStack.length - 1];
}
- get<T = any>(key: string): T {
- return this.getCurrentContext().get(key);
+ get<T = any>(key: string): T | undefined {
+ if (this.contextStack.length === 0) {
+ return undefined;
+ }
+ return this.contextStack[this.contextStack.length - 1].get(key);
}
set(key: string, value: any): void {