mirror of https://github.com/buster-so/buster.git
Focus input after chat comes in
This commit is contained in:
parent
c0745bc0c2
commit
fa42592b95
|
@ -1,4 +1,4 @@
|
|||
import React, { type ChangeEvent, useMemo, useRef, useState } from 'react';
|
||||
import React, { type ChangeEvent, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { InputTextAreaButton } from '@/components/ui/inputs/InputTextAreaButton';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { cn } from '@/lib/classMerge';
|
||||
|
@ -32,6 +32,14 @@ export const ChatInput: React.FC = React.memo(() => {
|
|||
setInputValue(e.target.value);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (hasChat) {
|
||||
requestAnimationFrame(() => {
|
||||
textAreaRef.current?.focus();
|
||||
});
|
||||
}
|
||||
}, [hasChat, textAreaRef]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
|
|
Loading…
Reference in New Issue