Skip to content

Commit

Permalink
fix: sometime PasswordAlert throws an error (race cond) — don't rende…
Browse files Browse the repository at this point in the history
…r it instead
  • Loading branch information
brusherru committed Sep 18, 2024
1 parent 5bdb130 commit 85c253f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/PasswordAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import usePassword from '../store/usePassword';

import PasswordInput from './PasswordInput';

function PasswordAlert(): JSX.Element {
function PasswordAlert(): JSX.Element | null {
const [isLoading, setIsLoading] = useState(false);
const { form } = usePassword();
const cancelRef = useRef<HTMLButtonElement>(null);
if (!form.register.password || !form.register.remember) {
throw new Error('PasswordAlert: password or remember is not registered');
return null;
}

const onSubmit = async () => {
Expand Down

0 comments on commit 85c253f

Please sign in to comment.