diff --git a/frontend/src/Components/Form/TextInput.tsx b/frontend/src/Components/Form/TextInput.tsx index 435cdb80c..d7bf800c5 100644 --- a/frontend/src/Components/Form/TextInput.tsx +++ b/frontend/src/Components/Form/TextInput.tsx @@ -8,6 +8,7 @@ import React, { useEffect, useRef, } from 'react'; +import useCombinedRefs from 'Helpers/Hooks/useCombinedRefs'; import { FileInputChanged, InputChanged } from 'typings/inputs'; import styles from './TextInput.css'; @@ -65,21 +66,7 @@ const TextInput = forwardRef( ref ) => { const inputRef = useRef(null); - - const setRef = useCallback( - (node: HTMLInputElement | null) => { - (inputRef as React.MutableRefObject).current = - node; - if (typeof ref === 'function') { - ref(node); - } else if (ref) { - (ref as React.MutableRefObject).current = - node; - } - }, - [ref] - ); - + const combinedRef = useCombinedRefs(ref, inputRef); const selectionTimeout = useRef>(); const selectionStart = useRef(); const selectionEnd = useRef(); @@ -172,7 +159,7 @@ const TextInput = forwardRef( return (