From 06134b02e0bf97afc5079dbe51393d04ca822e43 Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Wed, 4 Sep 2024 18:59:17 +0200 Subject: [PATCH] refactor: Simplify workspace initialization logic Improves the logic for initializing workspaces in the ZenWorkspaces module. The code now checks for the last used workspace and sets it as the active workspace if available. If the last used workspace is not found, it creates a default workspace or selects the first available workspace. This change enhances the user experience by automatically loading the last used workspace or providing a default option when no workspaces exist. (https://github.com/zen-browser/desktop/issues/1196) --- src/ZenWorkspaces.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index 4f71529..94f8e23 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -9,10 +9,10 @@ var ZenWorkspaces = { return; // We are in a hidden window, don't initialize ZenWorkspaces } console.info("ZenWorkspaces: Initializing ZenWorkspaces..."); - window.SessionStore.promiseInitialized.then(async () => { + setTimeout(async () => { await this.initializeWorkspaces(); console.info("ZenWorkspaces: ZenWorkspaces initialized"); - }) + }, 0); }, get workspaceEnabled() {