Skip to content

Commit

Permalink
Update waitForPromises to ensure all windows are restored before init…
Browse files Browse the repository at this point in the history
…ialization
  • Loading branch information
mauro-balades committed Jan 18, 2025
1 parent c44c63d commit fbfab42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/browser/base/zen-components/ZenWorkspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
});

async waitForPromises() {
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized, SessionStore.promiseInitialized]);
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized, SessionStore.promiseAllWindowsRestored]);
}

async init() {
Expand Down Expand Up @@ -71,6 +71,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
);
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
await this.waitForPromises();
this._delayedStartup();
}

Expand Down Expand Up @@ -382,7 +383,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}

async initializeWorkspaces() {
await this.waitForPromises();
await this.initializeWorkspacesButton();
if (this.workspaceEnabled) {
this._initializeWorkspaceCreationIcons();
Expand All @@ -403,11 +403,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
activeWorkspace = workspaces.workspaces[0];
this.activeWorkspace = activeWorkspace?.uuid;
}
await this.changeWorkspace(activeWorkspace, { onInit: true });
}
try {
if (activeWorkspace) {
window.gZenThemePicker = new ZenThemePicker();
await this.changeWorkspace(activeWorkspace, { onInit: true });
}
} catch (e) {
console.error('ZenWorkspaces: Error initializing theme picker', e);
Expand Down

0 comments on commit fbfab42

Please sign in to comment.