Password Form: Correctly unmount component (#1875)

This commit is contained in:
Alexander Zinchuk 2022-05-16 13:34:30 +02:00
parent c92a18895e
commit 8cd778ac5f

View File

@ -7,6 +7,7 @@ import { MIN_PASSWORD_LENGTH } from '../../config';
import { IS_TOUCH_ENV, IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment'; import { IS_TOUCH_ENV, IS_SINGLE_COLUMN_LAYOUT } from '../../util/environment';
import buildClassName from '../../util/buildClassName'; import buildClassName from '../../util/buildClassName';
import useLang from '../../hooks/useLang'; import useLang from '../../hooks/useLang';
import useTimeout from '../../hooks/useTimeout';
import Button from '../ui/Button'; import Button from '../ui/Button';
@ -44,13 +45,11 @@ const PasswordForm: FC<OwnProps> = ({
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [canSubmit, setCanSubmit] = useState(false); const [canSubmit, setCanSubmit] = useState(false);
useEffect(() => { useTimeout(() => {
if (!IS_TOUCH_ENV) { if (!IS_TOUCH_ENV) {
setTimeout(() => { inputRef.current!.focus();
inputRef.current!.focus();
}, FOCUS_DELAY_TIMEOUT_MS);
} }
}, []); }, FOCUS_DELAY_TIMEOUT_MS);
useEffect(() => { useEffect(() => {
if (error) { if (error) {