fix scroll to bottom on alert

This commit is contained in:
sam committed 2025-09-22 20:33:39 +07:00
1 parent c38113c9b8
commit ff95c13f84
1 file changed
+9
+9
View File
@@ -302,6 +302,15 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
const aiModelAlert = useAIModelErrorAlert(messages);
const consoleAlert = useConsoleErrorAlert();
// Scroll to bottom when alerts appear
useEffect(() => {
if (aiModelAlert.hasError || consoleAlert.hasError) {
setTimeout(() => {
scrollToBottom();
}, 50);
}
}, [aiModelAlert.hasError, consoleAlert.hasError, scrollToBottom]);
const suggestErrorFix = useCallback((errorMessage: string, errorCount: number) => {
const errorText = errorCount === 1 ? 'this error' : 'these errors';
setInput(`The user gets ${errorText} in the app now: ${errorMessage}\n\nCan you identify the problem and create a concise fix.`);