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)
This commit is contained in:
mauro-balades 2024-09-04 18:59:17 +02:00
parent ddf84fa3df
commit 06134b02e0

View file

@ -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() {