@@ -18,7 +18,7 @@ import { delay, ensureBoundsAreVisible, waveKeyToElectronKey } from "./emain-uti
18
18
import { log } from "./log" ;
19
19
import { getElectronAppBasePath , unamePlatform } from "./platform" ;
20
20
import { updater } from "./updater" ;
21
-
21
+
22
22
export type WindowOpts = {
23
23
unamePlatform : string ;
24
24
} ;
@@ -302,14 +302,10 @@ export class WaveBrowserWindow extends BaseWindow {
302
302
303
303
// If the workspace is already owned by a window, then we can just call SwitchWorkspace without first prompting the user, since it'll just focus to the other window.
304
304
const workspaceList = await WorkspaceService . ListWorkspaces ( ) ;
305
- if ( ! workspaceList ?. find ( ( wse ) => wse . workspaceid === workspaceId ) ?. windowid ) {
306
- const curWorkspace = await WorkspaceService . GetWorkspace ( this . workspaceId ) ;
307
- if ( curWorkspace == undefined ) { // @jalileh this occurs when we have already deleted the current workspace
308
- await this . _queueActionInternal ( { op : "switchworkspace" , workspaceId } ) ;
309
- return ;
310
- }
311
-
312
- if ( isNonEmptyUnsavedWorkspace ( curWorkspace ) ) {
305
+ if ( ! workspaceList ?. find ( ( wse ) => wse . workspaceid === workspaceId ) ?. windowid ) {
306
+ const curWorkspace = await WorkspaceService . GetWorkspace ( this . workspaceId ) ;
307
+
308
+ if ( curWorkspace && isNonEmptyUnsavedWorkspace ( curWorkspace ) ) {
313
309
console . log (
314
310
`existing unsaved workspace ${ this . workspaceId } has content, opening workspace ${ workspaceId } in new window`
315
311
) ;
@@ -423,7 +419,7 @@ export class WaveBrowserWindow extends BaseWindow {
423
419
tabView ?. positionTabOffScreen ( curBounds ) ;
424
420
}
425
421
}
426
-
422
+
427
423
async queueCreateTab ( pinned = false ) {
428
424
await this . _queueActionInternal ( { op : "createtab" , pinned } ) ;
429
425
}
@@ -705,15 +701,15 @@ ipcMain.on("delete-workspace", (event, workspaceId) => {
705
701
console . log ( "user cancelled workspace delete" , workspaceId , ww ?. waveWindowId ) ;
706
702
return ;
707
703
}
708
-
709
- const newWorkspaceId = await WorkspaceService . DeleteWorkspace ( workspaceId )
704
+
705
+ const newWorkspaceId = await WorkspaceService . DeleteWorkspace ( workspaceId ) ;
710
706
console . log ( "delete-workspace done" , workspaceId , ww ?. waveWindowId ) ;
711
- if ( ww ?. workspaceId == workspaceId ) {
712
- if ( newWorkspaceId ) {
713
- await ww . switchWorkspace ( newWorkspaceId )
707
+ if ( ww ?. workspaceId == workspaceId ) {
708
+ if ( newWorkspaceId ) {
709
+ await ww . switchWorkspace ( newWorkspaceId ) ;
714
710
} else {
715
- console . log ( "delete-workspace closing window" , workspaceId , ww ?. waveWindowId ) ;
716
- ww . destroy ( ) ;
711
+ console . log ( "delete-workspace closing window" , workspaceId , ww ?. waveWindowId ) ;
712
+ ww . destroy ( ) ;
717
713
}
718
714
}
719
715
} ) ;
0 commit comments