fix(ui): ensure activePaneID consistency and avoid redundant updates
- commit
- f05de9b38fbf4cebe102de9287977f7ce438a84a
- author
- brice · · 2025-12-22 07:57 UTC
- parent
- 04b95bc
- signature
- unsigned
1 file · +6 -9
M internal/ui/coordinator/workspace.go +6 -9
| @@ -1476,13 +1476,8 @@ func (c *WorkspaceCoordinator) onTitleBarClick(ctx context.Context, stackNode *e | |||
| 1476 | 1476 | // Update domain model | |
| 1477 | 1477 | stackNode.ActiveStackIndex = clickedIndex | |
| 1478 | 1478 | ||
| 1479 | - | // Update workspace active pane | |
| 1480 | - | ws, wsView := c.getActiveWS() | |
| 1481 | - | if ws != nil { | |
| 1482 | - | ws.ActivePaneID = clickedPaneID | |
| 1483 | - | } | |
| 1484 | - | ||
| 1485 | - | // Update workspace view | |
| 1479 | + | // Update workspace view (also updates domain model) | |
| 1480 | + | _, wsView := c.getActiveWS() | |
| 1486 | 1481 | if wsView != nil { | |
| 1487 | 1482 | if err := wsView.SetActivePaneID(clickedPaneID); err != nil { | |
| 1488 | 1483 | log.Warn().Err(err).Msg("failed to set active pane in workspace view") | |
| @@ -1665,8 +1660,10 @@ func (c *WorkspaceCoordinator) insertPopupStacked(ctx context.Context, input Ins | |||
| 1665 | 1660 | ||
| 1666 | 1661 | c.insertStackChild(stackNode, input.PopupPane) | |
| 1667 | 1662 | ||
| 1668 | - | // Update workspace active pane | |
| 1669 | - | ws.ActivePaneID = input.PopupPane.ID | |
| 1663 | + | if wsView == nil { | |
| 1664 | + | // No workspace view to update; keep domain model consistent. | |
| 1665 | + | ws.ActivePaneID = input.PopupPane.ID | |
| 1666 | + | } | |
| 1670 | 1667 | ||
| 1671 | 1668 | if err := c.attachPopupPaneView(ctx, input, wsView, stackNode, log); err != nil { | |
| 1672 | 1669 | return err | |
| @@ -1476,13 +1476,8 @@ func (c *WorkspaceCoordinator) onTitleBarClick(ctx context.Context, stackNode *e | |||||
| 1476 | // Update domain model | 1476 | // Update domain model | ||
| 1477 | stackNode.ActiveStackIndex = clickedIndex | 1477 | stackNode.ActiveStackIndex = clickedIndex | ||
| 1478 | 1478 | ||||
| 1479 | - | // Update workspace active pane | 1479 | + | // Update workspace view (also updates domain model) |
| 1480 | - | ws, wsView := c.getActiveWS() | 1480 | + | _, wsView := c.getActiveWS() |
| 1481 | - | if ws != nil { | |||
| 1482 | - | ws.ActivePaneID = clickedPaneID | |||
| 1483 | - | } | |||
| 1484 | - | ||||
| 1485 | - | // Update workspace view | |||
| 1486 | if wsView != nil { | 1481 | if wsView != nil { | ||
| 1487 | if err := wsView.SetActivePaneID(clickedPaneID); err != nil { | 1482 | if err := wsView.SetActivePaneID(clickedPaneID); err != nil { | ||
| 1488 | log.Warn().Err(err).Msg("failed to set active pane in workspace view") | 1483 | log.Warn().Err(err).Msg("failed to set active pane in workspace view") | ||
| @@ -1665,8 +1660,10 @@ func (c *WorkspaceCoordinator) insertPopupStacked(ctx context.Context, input Ins | |||||
| 1665 | 1660 | ||||
| 1666 | c.insertStackChild(stackNode, input.PopupPane) | 1661 | c.insertStackChild(stackNode, input.PopupPane) | ||
| 1667 | 1662 | ||||
| 1668 | - | // Update workspace active pane | 1663 | + | if wsView == nil { |
| 1669 | - | ws.ActivePaneID = input.PopupPane.ID | 1664 | + | // No workspace view to update; keep domain model consistent. |
| 1665 | + | ws.ActivePaneID = input.PopupPane.ID | |||
| 1666 | + | } | |||
| 1670 | 1667 | ||||
| 1671 | if err := c.attachPopupPaneView(ctx, input, wsView, stackNode, log); err != nil { | 1668 | if err := c.attachPopupPaneView(ctx, input, wsView, stackNode, log); err != nil { | ||
| 1672 | return err | 1669 | return err | ||