mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 17:36:34 +00:00
Fix: Restore pinned tabs to their pinned URLs on startup if the option is checked
This change modifies the pinned tab initialization logic to restore pinned tabs to their original pinned URLs when the browser starts. Previously, pinned tabs would open to their last visited URL, even if the option for restoring them to the pinned URL was checked.
This commit is contained in:
@@ -68,9 +68,9 @@
|
||||
return this._enabled;
|
||||
}
|
||||
|
||||
async _refreshPinnedTabs() {
|
||||
async _refreshPinnedTabs({ init = false } = {}) {
|
||||
await this._initializePinsCache();
|
||||
this._initializePinnedTabs();
|
||||
this._initializePinnedTabs(init);
|
||||
}
|
||||
|
||||
async _initializePinsCache() {
|
||||
@@ -109,7 +109,7 @@
|
||||
return this._pinsCache;
|
||||
}
|
||||
|
||||
_initializePinnedTabs() {
|
||||
_initializePinnedTabs(init = false) {
|
||||
const pins = this._pinsCache;
|
||||
if (!pins?.length) {
|
||||
return;
|
||||
@@ -130,6 +130,10 @@
|
||||
// This is a valid pinned tab that matches a pin
|
||||
pinnedTabsByUUID.set(pinId, tab);
|
||||
pinsToCreate.delete(pinId);
|
||||
|
||||
if(lazy.zenPinnedTabRestorePinnedTabsToPinnedUrl && init) {
|
||||
this._resetTabToStoredState(tab);
|
||||
}
|
||||
} else {
|
||||
// This is a pinned tab that no longer has a corresponding pin
|
||||
gBrowser.removeTab(tab);
|
||||
|
@@ -48,7 +48,7 @@ var ZenPinnedTabsStorage = {
|
||||
CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
|
||||
`);
|
||||
|
||||
await gZenPinnedTabManager._refreshPinnedTabs();
|
||||
await gZenPinnedTabManager._refreshPinnedTabs({init: true});
|
||||
});
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user