Prevent flickering on confirmation decline.

- When larger confirmations were shown and then declined you'd typicaly get large chunks of content flickering upon typing or sending a subsequent request. This was primarily due to us leaving the latest confirmation as "updateable" / pending. This changeset addresses that by flushing any pending confirmation to the static container.

Part of https://b.corp.google.com/issues/414196943
This commit is contained in:
Taylor Mullen 2025-05-13 16:35:11 -07:00 committed by N. Taylor Mullen
parent e665d4f198
commit c4c11f1d65
1 changed files with 8 additions and 0 deletions

View File

@ -483,6 +483,10 @@ export const useGeminiStream = (
error: undefined,
};
updateFunctionResponseUI(responseInfo, ToolCallStatus.Success);
if (pendingHistoryItemRef.current) {
addItem(pendingHistoryItemRef.current, Date.now());
setPendingHistoryItem(null);
}
setStreamingState(StreamingState.Idle);
await submitQuery(functionResponse);
} finally {
@ -529,6 +533,10 @@ export const useGeminiStream = (
// Update UI to show cancellation/error
updateFunctionResponseUI(responseInfo, status);
if (pendingHistoryItemRef.current) {
addItem(pendingHistoryItemRef.current, Date.now());
setPendingHistoryItem(null);
}
setStreamingState(StreamingState.Idle);
}
};