Skip to content

Commit 766b486

Browse files
Merge pull request #18856 from mozilla/FXA-2704
fix(settings): make ModalVerifySession's input validation work on the first attempt
2 parents 846181a + 031296d commit 766b486

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • packages/fxa-settings/src/components/Settings/ModalVerifySession

packages/fxa-settings/src/components/Settings/ModalVerifySession/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ export const ModalVerifySession = ({
7474
getStatus();
7575
}, [session, onCompleted]);
7676

77-
const buttonDisabled =
78-
!formState.isDirty || !formState.isValid || account.loading;
77+
// Destructure formState in advance to avoid logical operator short-circuiting
78+
// causing the isValid field to be conditionally subscribed.
79+
const { isDirty, isValid } = formState;
80+
const buttonDisabled = !isDirty || !isValid || account.loading;
81+
7982
return (
8083
!session.verified && (
8184
<Modal

0 commit comments

Comments
 (0)