Found another erroneous layout bootstrap (#1442)

CreateTab already bootstraps its own layout, don't need
BootstrapNewWorkspaceLayout
This commit is contained in:
Evan Simkowitz 2024-12-09 15:22:41 -08:00 committed by GitHub
parent 43c134ea9a
commit 7c799d74eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 24 deletions

View File

@ -152,18 +152,6 @@ func ApplyPortableLayout(ctx context.Context, tabId string, layout PortableLayou
return nil 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 { func BootstrapStarterLayout(ctx context.Context) error {
ctx, cancelFn := context.WithTimeout(ctx, 2*time.Second) ctx, cancelFn := context.WithTimeout(ctx, 2*time.Second)
defer cancelFn() defer cancelFn()

View File

@ -80,15 +80,6 @@ func CreateWindow(ctx context.Context, winSize *waveobj.WinSize, workspaceId str
return nil, fmt.Errorf("error creating workspace: %w", err) return nil, fmt.Errorf("error creating workspace: %w", err)
} }
ws = ws1 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 { } else {
ws1, err := GetWorkspace(ctx, workspaceId) ws1, err := GetWorkspace(ctx, workspaceId)
if err != nil { if err != nil {

View File

@ -31,17 +31,18 @@ func CreateWorkspace(ctx context.Context, name string, icon string, color string
if err != nil { if err != nil {
return nil, fmt.Errorf("error inserting workspace: %w", err) return nil, fmt.Errorf("error inserting workspace: %w", err)
} }
_, err = CreateTab(ctx, ws.OID, "", true, false, isInitialLaunch) _, err = CreateTab(ctx, ws.OID, "", true, false, isInitialLaunch)
if err != nil { if err != nil {
return nil, fmt.Errorf("error creating tab: %w", err) return nil, fmt.Errorf("error creating tab: %w", err)
} }
wps.Broker.Publish(wps.WaveEvent{
Event: wps.Event_WorkspaceUpdate})
ws, err = GetWorkspace(ctx, ws.OID) ws, err = GetWorkspace(ctx, ws.OID)
if err != nil { if err != nil {
return nil, fmt.Errorf("error getting updated workspace: %w", err) return nil, fmt.Errorf("error getting updated workspace: %w", err)
} }
wps.Broker.Publish(wps.WaveEvent{
Event: wps.Event_WorkspaceUpdate})
return ws, nil return ws, nil
} }