Skip to content

Commit

Permalink
fix(react-formio): Fix useForm create instance method
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Mar 30, 2021
1 parent 1d5b528 commit fede0a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/react-formio/src/components/form/useForm.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const useForm = ({
useEffect(
() => () => {
isLoaded.current = false;
return formio.current ? formio.current.destroy(true) : null;
if (formio.current) {
formio.current.destroy(true);
}
formio.current = null;
},
[formio]
);
Expand Down Expand Up @@ -67,6 +70,8 @@ export const useForm = ({
const createWebFormInstance = async (srcOrForm: any): Promise<any> => {
const { formioform, onFormReady } = props;
if (instance.current) {
formio.current = await instance.current.ready;

return formio.current;
}

Expand Down

0 comments on commit fede0a8

Please sign in to comment.