wsmd/react-use-form-state

[bug] validate called with undefined on blur for raw (and perhaps other) inputs

derrickbeining opened this issue · 1 comments

version 0.10.0

I believe I've encountered a bug and have opened a corresponding pull request with a potential solution (see #73).

Basically, for raw, I'm finding that my validate function is being invoked with undefined on blur, even when I set validateOnBlur to false, which is causing run-time errors.

So the problem appears to be two-fold.

  1. validate shouldn't be getting undefined passed to it
  2. validate shouldn't be called on blur when validateOnBlur is false (the default setting, I believe).

Please review my PR whenever you have a moment.

Here's a CodeSandbox reproducing the issue: https://codesandbox.io/s/y7vy11761x