Skip to content

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

:bug: Fix recently closed tabs stack trimming https://github.com/siyuan-note/siyuan/issues/19447

Daniel78d032a7c510
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index 47c0f26afb..0b22c09896 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -951,14 +951,14 @@ export class Wnd {
}
window.siyuan.storage[Constants.LOCAL_CLOSED_TABS] =
sanitizeClosedTabs(window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);
- if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > Constants.SIZE_UNDO) {
- window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop();
- }
if (item.headElement && !isSensitiveTab(item)) {
const tabJSON = {};
layoutToJSON(item, tabJSON);
window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON);
}
+ while (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > Constants.SIZE_UNDO) {
+ window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].shift();
+ }
setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);
if (item.model instanceof Custom && item.model.beforeDestroy) {
item.model.beforeDestroy();