Refactor pinned tab position handling to use cached pin objects for improved performance

This commit is contained in:
mr. M
2025-01-02 15:40:59 +01:00
parent 45b0e0a7ab
commit 2ce0eae82e
2 changed files with 34 additions and 12 deletions

View File

@@ -288,12 +288,15 @@
for (let otherTab of gBrowser.tabs) {
if (otherTab.pinned && otherTab._tPos > tab.position) {
otherTab.position = otherTab._tPos;
await ZenPinnedTabsStorage.savePin(otherTab, false);
const actualPin = this._pinsCache.find(pin => pin.uuid === otherTab.getAttribute("zen-pin-id"));
actualPin.position = otherTab._tPos;
await ZenPinnedTabsStorage.savePin(actualPin, false);
}
}
await ZenPinnedTabsStorage.savePin(tab);
const actualPin = this._pinsCache.find(pin => pin.uuid === tab.getAttribute("zen-pin-id"));
actualPin.position = tab.position;
await ZenPinnedTabsStorage.savePin(actualPin);
}
_onTabClick(e) {