fix: border flash

This commit is contained in:
Tomasz Stefaniak 2025-07-31 13:24:30 -07:00
parent 2455eba074
commit 381237b419
2 changed files with 16 additions and 4 deletions

View file

@ -276,7 +276,20 @@ export const streamNormalInput = createAsyncThunk<
console.error("Failed to send dev data interaction log", e);
}
}
dispatch(setInactive());
// Check if we have any tool calls that were just generated
const newState = getState();
const allToolCallStates = selectCurrentToolCalls(newState);
const generatingToolCalls = allToolCallStates.filter(
(toolCallState) => toolCallState.status === "generating",
);
// Only set inactive if there are no tool calls to process
// This prevents UI flashing when tool calls are about to be executed
if (generatingToolCalls.length === 0) {
dispatch(setInactive());
}
await handleToolCallExecution(dispatch, getState);
},
);

View file

@ -366,8 +366,8 @@ describe("streamResponseThunk - tool calls", () => {
unsubscribe();
// Verify no UI flashing during auto-approved tool execution
// DESIRED: Should show: [true, false] - stream starts, then stops after everything is done
// This prevents the UI from switching between StreamingToolbar and PendingToolCallToolbar
// DESIRED: Should stay true throughout tool execution, only becoming false at the very end
// We expect [true, false] - streaming starts true, stays true during tool execution, then false when all done
expect(streamingStateChanges).toEqual([true, false]);
// Verify key actions are dispatched (tool calls trigger a complex cascade, so we verify key actions exist)
@ -392,7 +392,6 @@ describe("streamResponseThunk - tool calls", () => {
"session/streamUpdate",
"session/streamUpdate",
"session/addPromptCompletionPair",
"session/setInactive",
"session/setToolGenerated",
"chat/callTool/pending",
"session/setToolCallCalling",