Skip to content

Commit

Permalink
Revert "fix(react-formio): Fix Form about onSubmit & onSubmitDone eve…
Browse files Browse the repository at this point in the history
…nts"
  • Loading branch information
Romakita committed Nov 17, 2021
1 parent 47929b7 commit 9ce6c29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/config/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
],
coverageThreshold: {
global: {
branches: 35.73,
branches: 36.53,
functions: 51.76,
lines: 50.49,
statements: 50.91,
Expand Down
14 changes: 8 additions & 6 deletions packages/react-formio/src/components/form/useForm.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ export const useForm = (props: any): any => {
}, [src]);

useEffect(() => {
props.onSubmit && events.current.set("onSubmit", props.onSubmit);
}, [props.onSubmit, events]);
if (form) {
createWebForm(form, options);
}

useEffect(() => {
props.onSubmitDone &&
events.current.set("onSubmitDone", props.onSubmitDone);
}, [props.onSubmitDone, events]);
return () => {
isLoaded.current = false;
instance.current && instance.current.destroy(true);
};
}, []);

return {
element
Expand Down

0 comments on commit 9ce6c29

Please sign in to comment.