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:
Mohamed Boudra
2026-03-21 14:29:55 +07:00
parent e6bc752b68
commit 5ae7a0c9c2
4 changed files with 204 additions and 188 deletions
+4 -11
View File
@@ -194,20 +194,13 @@ export function useArchiveAgent() {
},
});
const archiveMutateAsync = archiveMutation.mutateAsync;
const archiveAgent = useCallback(
async (input: ArchiveAgentInput): Promise<void> => {
if (
isAgentArchiving({
queryClient,
serverId: input.serverId,
agentId: input.agentId,
})
) {
return;
}
await archiveMutation.mutateAsync(input);
await archiveMutateAsync(input);
},
[archiveMutation, queryClient]
[archiveMutateAsync]
);
const isArchivingAgent = useCallback(