Open danielberndt opened 6 years ago
I've created a FieldWrapper that looks somewhat like this:
const MyField ({name, as: Component}) => ( <Field name={name}> {({field: {onChange, onBlur, ...rest}, form}) => ( <Component onBlur={onBlur(name)} onChange={onChange(name)} {...rest} /> )}</Field> )
I'm using this to wrap external Inputs. Those Inputs don't always pass an event when firing onBlur though. I expected this to be fine by formik, because I passed the name of the corresponding field explicitly.
event
onBlur
name
It turns out though that the following lines still try to access the event, even though there's no need to when the path is explicitly passed. https://github.com/jaredpalmer/formik/blob/85d15b302cd776eb615064a4451e1a7575b1439d/src/Formik.tsx#L444-L445
path
Is it possible/reasonable to rewrite those lines in a way that e is not accessed when the path is passed?
e
Agree, I fixed this in v2. They should use the override.
🐛 Bug report
I've created a FieldWrapper that looks somewhat like this:
I'm using this to wrap external Inputs. Those Inputs don't always pass an
event
when firingonBlur
though. I expected this to be fine by formik, because I passed thename
of the corresponding field explicitly.It turns out though that the following lines still try to access the
event
, even though there's no need to when thepath
is explicitly passed. https://github.com/jaredpalmer/formik/blob/85d15b302cd776eb615064a4451e1a7575b1439d/src/Formik.tsx#L444-L445Is it possible/reasonable to rewrite those lines in a way that
e
is not accessed when thepath
is passed?