From e7b1c5a95f313b5f220a7455d3a891bf408f763a Mon Sep 17 00:00:00 2001 From: Aleksandar Petkov Date: Mon, 4 Dec 2023 16:33:11 +0200 Subject: [PATCH] one-time-donation/LoginForm.tsx: Refetch useCurrentPerson when logged in (#1677) When user logs in trough donation step 2, person's data remains undefined due to data not being updated. Manually refetch the data coming from useCurrentPerson() after login to refresh the user's data --- src/components/client/one-time-donation/LoginForm.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/client/one-time-donation/LoginForm.tsx b/src/components/client/one-time-donation/LoginForm.tsx index 9ddb75e7b..34e7979c7 100644 --- a/src/components/client/one-time-donation/LoginForm.tsx +++ b/src/components/client/one-time-donation/LoginForm.tsx @@ -14,6 +14,7 @@ import PasswordField from 'components/common/form/PasswordField' import LinkButton from 'components/common/LinkButton' import { StepsContext } from './helpers/stepperContext' import { AlertStore } from 'stores/AlertStore' +import { useCurrentPerson } from 'common/util/useCurrentPerson' const onGoogleLogin = () => signIn('google') @@ -22,6 +23,7 @@ function LoginForm() { const [loading, setLoading] = useState(false) const { setStep } = useContext(StepsContext) const formik = useFormikContext() + const { refetch } = useCurrentPerson() const onClick = async () => { try { @@ -36,6 +38,7 @@ function LoginForm() { throw new Error(resp.error) } if (resp?.ok) { + refetch() setLoading(false) formik.setFieldValue('isAnonymous', false) setStep(2)