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-05 23:34:25 +00:00
parent d6635a4c64
commit a712bf3840
5 changed files with 100 additions and 32 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 } })
);