Skip to content

Commit

Permalink
Initialize fieldstates at the start
Browse files Browse the repository at this point in the history
  • Loading branch information
amitbadala committed Oct 27, 2023
1 parent 90a9344 commit 7e6a3ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/build/emailpassword-shared7.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/ts/recipe/emailpassword/components/library/formBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export const FormBase: React.FC<FormBaseProps<any>> = (props) => {
};
}, [unmounting]);

const [fieldStates, setFieldStates] = useState<FieldState[]>([]);
const [fieldStates, setFieldStates] = useState<FieldState[]>(
props.formFields.map((f) => ({ id: f.id, value: "" }))
);
const [isLoading, setIsLoading] = useState(false);

useEffect(() => {
Expand Down

0 comments on commit 7e6a3ec

Please sign in to comment.