From ecbce38f52aef4d39d88aaacec9e399004a4c3b6 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Sun, 15 Jun 2025 06:08:01 +0200 Subject: [PATCH] fix: Fixed deleting a workspace from context not working, b=no-bug, c=workspaces --- src/zen/workspaces/ZenWorkspaces.mjs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index dddfd056a..8ee136556 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -1215,10 +1215,10 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { async removeWorkspace(windowID) { let workspacesData = await this._workspaces(); - this._deleteAllTabsInWorkspace(windowID); await this.changeWorkspace( workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID) ); + this._deleteAllTabsInWorkspace(windowID); delete this._lastSelectedWorkspaceTabs[windowID]; await ZenWorkspacesStorage.removeWorkspace(windowID); // Remove the workspace from the cache @@ -1227,12 +1227,8 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { ); await this._propagateWorkspaceData(); await this._updateWorkspacesChangeContextMenu(); + this.workspaceElement(windowID)?.remove(); this.onWindowResize(); - for (let container of document.querySelectorAll( - `.zen-workspace-tabs-section[zen-workspace-id="${windowID}"]` - )) { - container.remove(); - } this.registerPinnedResizeObserver(); } @@ -1379,7 +1375,9 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { gBrowser.removeTabs( Array.from(this.allStoredTabs).filter( (tab) => - tab.getAttribute('zen-workspace-id') === workspaceID && !tab.hasAttribute('zen-empty-tab') + tab.getAttribute('zen-workspace-id') === workspaceID && + !tab.hasAttribute('zen-empty-tab') && + !tab.hasAttribute('zen-essential') ), { animate: false, @@ -2395,12 +2393,13 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { } async contextDeleteWorkspace() { + const workspaceId = this.#contextMenuData?.workspaceId || this.activeWorkspace; const [title, body] = await document.l10n.formatValues([ { id: 'zen-workspaces-delete-workspace-title' }, { id: 'zen-workspaces-delete-workspace-body' }, ]); if (Services.prompt.confirm(null, title, body)) { - await this.removeWorkspace(this.#contextMenuData?.workspaceId || this.activeWorkspace); + await this.removeWorkspace(workspaceId); } }