Fix an issue where the AI Assistant input textbox sometimes swallows the first character of input. #9740

pull/9739/head^2
Dave Page 2026-03-16 06:36:47 +00:00 committed by GitHub
parent c8bd75c9a8
commit 78e3b67eb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -31,3 +31,4 @@ Bug fixes
| `Issue #9279 <https://github.com/pgadmin-org/pgadmin4/issues/9279>`_ - Fixed an issue where OAuth2 authentication fails with 'object has no attribute' if OAUTH2_AUTO_CREATE_USER is False.
| `Issue #9392 <https://github.com/pgadmin-org/pgadmin4/issues/9392>`_ - Ensure that the Geometry Viewer refreshes when re-running queries or switching geometry columns, preventing stale data from being displayed.
| `Issue #9721 <https://github.com/pgadmin-org/pgadmin4/issues/9721>`_ - Fixed an issue where permissions page is not completely accessible on full scroll.
| `Issue #9740 <https://github.com/pgadmin-org/pgadmin4/issues/9740>`_ - Fixed an issue where the AI Assistant input textbox sometimes swallows the first character of input.

View File

@ -288,6 +288,7 @@ export function NLQChatPanel() {
});
const messagesEndRef = useRef(null);
const inputRef = useRef(null);
const abortControllerRef = useRef(null);
const readerRef = useRef(null);
const stoppedRef = useRef(false);
@ -366,6 +367,16 @@ export function NLQChatPanel() {
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
}, [messages]);
// Auto-focus the input when loading completes
useEffect(() => {
if (!isLoading) {
// Defer focus to ensure the DOM has updated (disabled=false)
setTimeout(() => {
inputRef.current?.focus();
}, 0);
}
}, [isLoading]);
// Force CodeMirror re-render when panel becomes visible (fixes tab switching issue)
const [cmKey, setCmKey] = useState(0);
useEffect(() => {
@ -741,6 +752,7 @@ export function NLQChatPanel() {
<InputArea>
<TextField
inputRef={inputRef}
fullWidth
multiline
minRows={1}