Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16879

Vanessa305c24706961
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index c5f0885f00..5260996df5 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -787,10 +787,12 @@ export class Wnd {
if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > Constants.SIZE_UNDO) {
window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop();
}
- const tabJSON = {};
- layoutToJSON(item, tabJSON);
- window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON);
- setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);
+ if (item.headElement) {
+ const tabJSON = {};
+ layoutToJSON(item, tabJSON);
+ window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON);
+ setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);
+ }
if (item.model instanceof Custom && item.model.beforeDestroy) {
item.model.beforeDestroy();
}