Bug 1921836 - Consolidate the restoreSidebar implementations, and ensure the sidebar launcher gets un-hidden when a sidebar is shown. r=sidebar-reviewers,sessionstore-reviewers,jsudiaman,sclements

Differential Revision: https://phabricator.services.mozilla.com/D227420
This commit is contained in:
Sam Foster
2024-11-04 18:54:59 +00:00
parent 49a33e6a66
commit 149a4a2aa9
4 changed files with 69 additions and 25 deletions

View File

@@ -484,10 +484,18 @@ var SidebarController = {
if (!state) {
return;
}
const shouldOpenSidebar =
state.command &&
this.sidebars.has(state.command) &&
this.currentID !== state.command;
if (shouldOpenSidebar) {
// there's a sidebar to show, so ignore the contradictory hidden property
delete state.hidden;
}
if (state.width) {
this._box.style.width = state.width;
}
if (state.command && this.currentID != state.command && !this.isOpen) {
if (shouldOpenSidebar && !this.isOpen) {
await this.showInitially(state.command);
}
if (this.sidebarRevampEnabled) {
@@ -1480,6 +1488,7 @@ var SidebarController = {
_show(commandID) {
return new Promise(resolve => {
if (this.sidebarRevampEnabled) {
this.sidebarContainer.hidden = false;
this._box.dispatchEvent(
new CustomEvent("sidebar-show", { detail: { viewId: commandID } })
);