Use useRefMerger in Input to avoid re-renders

Co-authored-by: Josh Perez <60019601+josh-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2022-04-21 16:32:01 -07:00 committed by GitHub
parent 7344f480c1
commit 8faf3bfbec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,7 @@ import classNames from 'classnames';
import * as grapheme from '../util/grapheme';
import type { LocalizerType } from '../types/Util';
import { getClassNamesFor } from '../util/getClassNamesFor';
import { refMerger } from '../util/refMerger';
import { useRefMerger } from '../hooks/useRefMerger';
import { byteLength } from '../Bytes';
export type PropsType = {
@ -84,6 +84,7 @@ export const Input = forwardRef<
const valueOnKeydownRef = useRef<string>(value);
const selectionStartOnKeydownRef = useRef<number>(value.length);
const [isLarge, setIsLarge] = useState(false);
const refMerger = useRefMerger();
const maybeSetLarge = useCallback(() => {
if (!expandable) {