Skip to content

Commit

Permalink
fix: Ensure Correct Focus on Playground Chat Input (#3582)
Browse files Browse the repository at this point in the history
✨ (textAreaWrapper/index.tsx): add useEffect hook to focus on input when conditions are met
♻️ (AppWrapperPage/index.tsx): remove unnecessary console.log statement
  • Loading branch information
Cristhianzl authored Aug 28, 2024
1 parent 71a9524 commit ffff572
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from "react";
import { Textarea } from "../../../../../../../components/ui/textarea";
import { classNames } from "../../../../../../../utils/utils";

Expand Down Expand Up @@ -43,6 +44,12 @@ const TextAreaWrapper = ({

const additionalClassNames = "form-modal-lockchat pl-14";

useEffect(() => {
if (!lockChat && !noInput && !saveLoading) {
inputRef.current?.focus();
}
}, [lockChat, noInput, saveLoading]);

return (
<Textarea
data-testid="input-chat-playground"
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/src/pages/AppWrapperPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export function AppWrapperPage() {

const [retryCount, setRetryCount] = useState(0);

console.log(healthCheckMaxRetries);

useEffect(() => {
const isServerBusy =
(error as AxiosError)?.response?.status === 503 ||
Expand Down

0 comments on commit ffff572

Please sign in to comment.