do not open keyboard on page load

This commit is contained in:
vchikalkin 2025-01-15 18:38:24 +03:00
parent 30b0d4d394
commit 21b2e983eb

View File

@ -78,11 +78,18 @@ function useDebouncedOnChangeCallback(
function useFocus(isPending: boolean) {
const inputRef = useRef<HTMLInputElement | null>(null);
const [isInitialRender, setIsInitialRender] = useState(true);
useEffect(() => {
if (inputRef.current) {
if (isInitialRender) {
setIsInitialRender(false);
return;
}
if (inputRef.current && isPending) {
inputRef.current.focus();
}
}, [isPending]);
}, [isInitialRender, isPending]);
return inputRef;
}