FormikOnBlur: update form on initialValues change
@@ -18,7 +18,7 @@ export function FormikOnBlur<
setSubmitting(true);
const { values } = formikBag;
formikBag.submitForm().then(() => {
- formikBag.resetForm({ values })
+ formikBag.resetForm({ values });
setSubmitting(false);
});
}
@@ -29,6 +29,10 @@ export function FormikOnBlur<
formikBag.isSubmitting
]);
+ useEffect(() => {
+ formikBag.resetForm({ values: props.initialValues });
+ }, [props.initialValues]);
+
const { children, innerRef } = props;
useImperativeHandle(innerRef, () => formikBag);
