mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:39:58 +02:00
refactor: Improve workspace initialization logic
Simplify 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 improves the user experience by automatically loading the last used workspace or providing a default option when no workspaces exist. Closes #376
This commit is contained in:
parent
e7e70f7ced
commit
ddf84fa3df
1 changed files with 2 additions and 2 deletions
|
@ -63,9 +63,9 @@ var ZenWorkspaces = {
|
|||
if (workspaces.workspaces.length === 0) {
|
||||
await this.createAndSaveWorkspace("Default Workspace", true);
|
||||
} else {
|
||||
let activeWorkspace = workspaces.workspaces.find(workspace => workspace.default);
|
||||
let activeWorkspace = workspaces.workspaces.find(workspace => workspace.used);
|
||||
if (!activeWorkspace) {
|
||||
activeWorkspace = workspaces.workspaces.find(workspace => workspace.used);
|
||||
activeWorkspace = workspaces.workspaces.find(workspace => workspace.default);
|
||||
activeWorkspace.used = true;
|
||||
await this.saveWorkspaces();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue