final-form / final-form/react-final-form

After submitting the form (firing redux action) the final-form interprets response from backend as validation errors

Open
#845 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

### Are you submitting a **bug report** or a **feature request**?

Bug report/feature request

### What is the current behavior?

When form values are received on the backend, the server responds with the updated data, which react-final-form interprets as a submission error (the `invalid` prop from react-final-form says `true`, even when the form was submitted successfully). This makes it very challenging to use react-final-form with redux (not for tracking local form state, but for dispatching redux actions).

### What is the expected behavior?
Do not interpret data returned from backend as validation error. Perhaps, only do so if there's an `error` field in the data sent from the backend.

### Sandbox Link

### What's your environment?

### Other information

The issue was explained in more detail on [stackoverflow](https://stackoverflow.com/questions/63297857/how-to-cancel-react-final-form-validation-after-form-submission).
As a workaround, I'm doing the following (_so the return would be `undefined`, because it's an arrow function in curly brackets_):
```tsx
{
fireAction(data)
}}>
```
instead of the normal
```tsx

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.