Formik: executeBlur should not inspect `event` if `path` is set

Created on 16 Nov 2018  路  1Comment  路  Source: formium/formik

馃悰 Bug report

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.

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

Is it possible/reasonable to rewrite those lines in a way that e is not accessed when the path is passed?

Bug pinned

Most helpful comment

Agree, I fixed this in v2. They should use the override.

>All comments

Agree, I fixed this in v2. They should use the override.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pmonty picture pmonty  路  3Comments

jeffbski picture jeffbski  路  3Comments

najisawas picture najisawas  路  3Comments

PeerHartmann picture PeerHartmann  路  3Comments

outaTiME picture outaTiME  路  3Comments