fix(app): stabilize terminal creation handler
This commit is contained in:
@@ -1264,34 +1264,24 @@ function WorkspaceScreenContent({
|
|||||||
[focusWorkspacePane, openWorkspaceDraftTab, persistenceKey],
|
[focusWorkspacePane, openWorkspaceDraftTab, persistenceKey],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleCreateTerminal = useCallback(
|
const handleCreateTerminal = useStableEvent((input?: { paneId?: string }) => {
|
||||||
(input?: { paneId?: string }) => {
|
if (createTerminalMutation.isPending || pendingTerminalCreateInput) {
|
||||||
if (createTerminalMutation.isPending || pendingTerminalCreateInput) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (canCreateTerminalNow) {
|
if (canCreateTerminalNow) {
|
||||||
createTerminalMutation.mutate(input);
|
createTerminalMutation.mutate(input);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasHydratedWorkspaces && isMissingWorkspaceExecutionAuthority) {
|
if (hasHydratedWorkspaces && isMissingWorkspaceExecutionAuthority) {
|
||||||
toast.error("Workspace path is not available yet");
|
toast.error("Workspace path is not available yet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPendingTerminalCreateInput(input ?? {});
|
setPendingTerminalCreateInput(input ?? {});
|
||||||
toast.show("Preparing workspace, opening terminal when ready...");
|
toast.show("Preparing workspace, opening terminal when ready...");
|
||||||
},
|
});
|
||||||
[
|
|
||||||
canCreateTerminalNow,
|
|
||||||
createTerminalMutation,
|
|
||||||
hasHydratedWorkspaces,
|
|
||||||
isMissingWorkspaceExecutionAuthority,
|
|
||||||
pendingTerminalCreateInput,
|
|
||||||
toast,
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleSelectSwitcherTab = useCallback(
|
const handleSelectSwitcherTab = useCallback(
|
||||||
(key: string) => {
|
(key: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user