mirror of https://github.com/buster-so/buster.git
Merge pull request #493 from buster-so/big-nate/bus-1369-auto-select-chat
Big nate/bus 1369 auto select chat
This commit is contained in:
commit
cfa91882c9
|
@ -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 { InputTextAreaButton } from '@/components/ui/inputs/InputTextAreaButton';
|
||||||
import { useMemoizedFn } from '@/hooks';
|
import { useMemoizedFn } from '@/hooks';
|
||||||
import { cn } from '@/lib/classMerge';
|
import { cn } from '@/lib/classMerge';
|
||||||
|
@ -32,6 +32,14 @@ export const ChatInput: React.FC = React.memo(() => {
|
||||||
setInputValue(e.target.value);
|
setInputValue(e.target.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (hasChat) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
textAreaRef.current?.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [hasChat, textAreaRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|
Loading…
Reference in New Issue