Skip to content

Commit

Permalink
fix: use usecallback
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed May 20, 2024
1 parent 9bce904 commit affc114
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
}
}, [defaultSelection, selectedPeer, selectedRole, setRoleSelector, isMobile, isLandscapeHLSStream, elements?.chat]);

const resetInputHeight = () => {
const resetInputHeight = useCallback(() => {
if (inputRef.current) {
inputRef.current.style.height = `${Math.max(32, inputRef.current.value ? inputRef.current.scrollHeight : 0)}px`;
}
};
}, []);

const updateInputHeight = () => {
const updateInputHeight = useCallback(() => {
if (inputRef.current) {
inputRef.current.style.height = `${Math.max(32, Math.min(inputRef.current.scrollHeight, 24 * 4))}px`;
}
};
}, []);

const sendMessage = useCallback(async () => {
const message = inputRef?.current?.value;
Expand Down

0 comments on commit affc114

Please sign in to comment.