fix: Restore user input when the user cancels response (#5601)

Co-authored-by: Shi Shu <shii@google.com>
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
shishu314
2025-08-06 15:19:10 -04:00
committed by GitHub
parent 6133bea388
commit 1f0ad86544
3 changed files with 87 additions and 10 deletions

View File

@@ -94,6 +94,7 @@ export const useGeminiStream = (
modelSwitchedFromQuotaError: boolean,
setModelSwitchedFromQuotaError: React.Dispatch<React.SetStateAction<boolean>>,
onEditorClose: () => void,
onCancelSubmit: () => void,
) => {
const [initError, setInitError] = useState<string | null>(null);
const abortControllerRef = useRef<AbortController | null>(null);
@@ -200,6 +201,7 @@ export const useGeminiStream = (
Date.now(),
);
setPendingHistoryItem(null);
onCancelSubmit();
setIsResponding(false);
}
});