From 7c799d74eb538b47e1ca8f9309ed948c3f283bb0 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Mon, 9 Dec 2024 15:22:41 -0800 Subject: [PATCH] Found another erroneous layout bootstrap (#1442) CreateTab already bootstraps its own layout, don't need BootstrapNewWorkspaceLayout --- pkg/wcore/layout.go | 12 ------------ pkg/wcore/window.go | 9 --------- pkg/wcore/workspace.go | 7 ++++--- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/pkg/wcore/layout.go b/pkg/wcore/layout.go index 87ae335f5..9bca8d24f 100644 --- a/pkg/wcore/layout.go +++ b/pkg/wcore/layout.go @@ -152,18 +152,6 @@ func ApplyPortableLayout(ctx context.Context, tabId string, layout PortableLayou return nil } -func BootstrapNewWorkspaceLayout(ctx context.Context, workspace *waveobj.Workspace) error { - log.Printf("BootstrapNewWorkspaceLayout, workspace: %v\n", workspace) - tabId := workspace.ActiveTabId - newTabLayout := GetNewTabLayout() - - err := ApplyPortableLayout(ctx, tabId, newTabLayout) - if err != nil { - return fmt.Errorf("error applying new window layout: %w", err) - } - return nil -} - func BootstrapStarterLayout(ctx context.Context) error { ctx, cancelFn := context.WithTimeout(ctx, 2*time.Second) defer cancelFn() diff --git a/pkg/wcore/window.go b/pkg/wcore/window.go index 31e757a3a..81035b144 100644 --- a/pkg/wcore/window.go +++ b/pkg/wcore/window.go @@ -80,15 +80,6 @@ func CreateWindow(ctx context.Context, winSize *waveobj.WinSize, workspaceId str return nil, fmt.Errorf("error creating workspace: %w", err) } ws = ws1 - err = BootstrapNewWorkspaceLayout(ctx, ws) - if err != nil { - errStr := fmt.Errorf("error bootstrapping new workspace layout: %w", err) - _, err = DeleteWorkspace(ctx, ws.OID, true) - if err != nil { - errStr = fmt.Errorf("%s\nerror deleting workspace: %w", errStr, err) - } - return nil, errStr - } } else { ws1, err := GetWorkspace(ctx, workspaceId) if err != nil { diff --git a/pkg/wcore/workspace.go b/pkg/wcore/workspace.go index 4363d9a22..d366723c6 100644 --- a/pkg/wcore/workspace.go +++ b/pkg/wcore/workspace.go @@ -31,17 +31,18 @@ func CreateWorkspace(ctx context.Context, name string, icon string, color string if err != nil { return nil, fmt.Errorf("error inserting workspace: %w", err) } - _, err = CreateTab(ctx, ws.OID, "", true, false, isInitialLaunch) if err != nil { return nil, fmt.Errorf("error creating tab: %w", err) } + + wps.Broker.Publish(wps.WaveEvent{ + Event: wps.Event_WorkspaceUpdate}) + ws, err = GetWorkspace(ctx, ws.OID) if err != nil { return nil, fmt.Errorf("error getting updated workspace: %w", err) } - wps.Broker.Publish(wps.WaveEvent{ - Event: wps.Event_WorkspaceUpdate}) return ws, nil }