Skip to content

Commit

Permalink
Merge pull request #3173 from Eragonfr/feature/dont-reload-sidepanel-…
Browse files Browse the repository at this point in the history
…on-toggle

Don't reload sidepanel browsers when not needed
  • Loading branch information
mauro-balades authored Nov 28, 2024
2 parents 4561112 + 878df5a commit 6d41232
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/browser/base/zen-components/ZenSidebarManager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
this.initProgressListener();
this.update();
this.close(); // avoid caching
this.tabBox.prepend(this.sidebarWrapper);
this.listenForPrefChanges();
this.insertIntoContextMenu();
this.addPositioningListeners();
Expand Down Expand Up @@ -269,11 +270,6 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {

open() {
let sidebar = document.getElementById('zen-sidebar-web-panel');
if (!this.sidebar.hasAttribute('pinned')) {
this.moveToTabBoxWrapper();
} else {
this.moveToTabBox();
}
sidebar.removeAttribute('hidden');
this.update();
}
Expand Down Expand Up @@ -304,6 +300,11 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
return;
}

// Don't reload content if at least one of the panel tabs was loaded
if (this._lastOpenedPanel) {
return;
}

let data = this.sidebarData;
if (!data.data || !data.index) {
return;
Expand Down Expand Up @@ -598,22 +599,11 @@ class ZenBrowserManagerSidebar extends ZenDOMOperatedFeature {
this._updateSidebarButton();
}

moveToTabBoxWrapper() {
document.getElementById('zen-appcontent-wrapper').before(this.sidebarWrapper);
this.sidebarWrapper.style.order = '';
}

moveToTabBox() {
this.tabBox.prepend(this.sidebarWrapper);
}

togglePinned(elem) {
if (this.sidebar.hasAttribute('pinned')) {
this._removePinnedFromElements();
this.moveToTabBoxWrapper();
} else {
this._setPinnedToElements();
this.moveToTabBox();
}
this.update();
}
Expand Down

0 comments on commit 6d41232

Please sign in to comment.