From ff95c13f8418be53060404cd6d514eceff823e41 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 22 Sep 2025 20:33:39 +0700 Subject: [PATCH] fix scroll to bottom on alert --- src/components/Shakespeare/ChatPane.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx index ba574047..0a0a6aef 100644 --- a/src/components/Shakespeare/ChatPane.tsx +++ b/src/components/Shakespeare/ChatPane.tsx @@ -302,6 +302,15 @@ export const ChatPane = forwardRef(({ 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.`);