jquense / react-formal

Sophisticated HTML form management for React
http://jquense.github.io/react-formal
MIT License
526 stars 52 forks source link

onError is called on initial render #144

Closed aliustaoglu closed 6 years ago

aliustaoglu commented 6 years ago

I have a very simple code snippet. When I check the console I see on error called even right after page loaded for the first time. I expect onError to be called on error happens not on load or initial render.

onError(event) {
    console.log('on error called');
  }
<Form
        schema={modelSchema}
        className="login-form at__loginForm"
        onSubmit={onSubmitFunc}
        onError={this.onError}
>

If I set state onError event this will cause an endless loop.

So it seems related to issue https://github.com/jquense/react-formal/issues/69 but I cannot and don't want to define my modelSchema outside the component because it's formed from the props.

Cheers