fix(app): reduce unnecessary workspace screen re-renders from unstable callback deps
- Add useCloseTabs hook to centralize tab close state with stable closeTab callback and reactive closingTabIds - Replace killTerminalMutation/isArchivingAgent props with closingTabIds Set in split container - Stabilize archiveAgent callback by depending on mutateAsync instead of whole mutation object - Add bail-out to focusTabInLayout and focusPaneInLayout when already focused - Remove redundant isArchivingAgent guard (closeTab handles dedup)
This commit is contained in:
@@ -995,6 +995,10 @@ export function focusTabInLayout(input: FocusTabInLayoutInput): WorkspaceLayout
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pane.focusedTabId === input.tabId && layout.focusedPaneId === pane.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
root: focusTabInPane(layout.root, pane.id, input.tabId),
|
||||
focusedPaneId: pane.id,
|
||||
@@ -1157,6 +1161,9 @@ export function focusPaneInLayout(input: FocusPaneInLayoutInput): WorkspaceLayou
|
||||
if (!findPaneById(input.layout.root, input.paneId)) {
|
||||
return null;
|
||||
}
|
||||
if (input.layout.focusedPaneId === input.paneId) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
root: input.layout.root,
|
||||
focusedPaneId: input.paneId,
|
||||
|
||||
Reference in New Issue
Block a user