From 87286ca776e7577aa8d19928a527bacec1ef45d8 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 7 Sep 2023 13:38:55 -0400 Subject: [PATCH] Remove tab content immediately Amends 30c70a6ecd53c64993b346506bd08f9cd2a6f93b. On some machines, the callback added in that change would never actually run, so memory usage would grow quickly when switching between tabs. By wrapping in setTimeout() instead of requestIdleCallback(), we keep the performance gains from removing once the element is no longer visible (so we can avoid repaints, rebuilding the layout tree, etc.), but we make sure that the callback gets called nearly immediately. #3321 --- chrome/content/zotero/tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index 9577369c84..cbf37d7e3b 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -288,7 +288,7 @@ var Zotero_Tabs = new function () { historyEntry.push({ index: tmpTabs.indexOf(tab), data: tab.data }); closedIDs.push(id); - requestIdleCallback(() => { + setTimeout(() => { document.getElementById(tab.id).remove(); // For unknown reason fx102, unlike 60, sometimes doesn't automatically update selected index let selectedIndex = Array.from(this.deck.children).findIndex(x => x.id == this._selectedID);