Fix switch workspace (#1370)

This commit is contained in:
Evan Simkowitz 2024-12-02 17:52:34 -05:00 committed by GitHub
parent f368a61c70
commit 0ec60f5a7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -243,6 +243,7 @@ export class WaveBrowserWindow extends BaseWindow {
} }
async switchWorkspace(workspaceId: string) { async switchWorkspace(workspaceId: string) {
console.log("switchWorkspace", workspaceId, this.waveWindowId);
const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId); const curWorkspace = await WorkspaceService.GetWorkspace(this.workspaceId);
if (curWorkspace.tabids.length > 1 && (!curWorkspace.name || !curWorkspace.icon)) { if (curWorkspace.tabids.length > 1 && (!curWorkspace.name || !curWorkspace.icon)) {
const choice = dialog.showMessageBoxSync(this, { const choice = dialog.showMessageBoxSync(this, {
@ -270,16 +271,16 @@ export class WaveBrowserWindow extends BaseWindow {
if (!newWs) { if (!newWs) {
return; return;
} }
console.log("switchWorkspace newWs", newWs);
if (this.allTabViews.size) { if (this.allTabViews.size) {
for (const tab of this.allTabViews.values()) { for (const tab of this.allTabViews.values()) {
tab?.destroy(); tab?.destroy();
} }
} }
console.log("destroyed all tabs", this.waveWindowId);
this.workspaceId = workspaceId; this.workspaceId = workspaceId;
this.allTabViews = new Map(); this.allTabViews = new Map();
const fullConfig = await FileService.GetFullConfig(); await this.setActiveTab(newWs.activetabid, false);
const [tabView, tabInitialized] = getOrCreateWebViewForTab(fullConfig, newWs.activetabid);
await this.queueTabSwitch(tabView, tabInitialized);
} }
async setActiveTab(tabId: string, setInBackend: boolean) { async setActiveTab(tabId: string, setInBackend: boolean) {

View File

@ -170,7 +170,7 @@ func (svc *WindowService) SwitchWorkspace(ctx context.Context, windowId string,
updates := waveobj.ContextGetUpdatesRtn(ctx) updates := waveobj.ContextGetUpdatesRtn(ctx)
go func() { go func() {
defer panichandler.PanicHandler("WorkspaceService:SwitchWorkspace:SendUpdateEvents") defer panichandler.PanicHandler("WindowService:SwitchWorkspace:SendUpdateEvents")
wps.Broker.SendUpdateEvents(updates) wps.Broker.SendUpdateEvents(updates)
}() }()
return ws, err return ws, err