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

FormSpy errors are different during every render, even if nothing changes

Open
#134 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
210
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Take this example: https://codesandbox.io/s/react-final-form-field-arrays-p7ntw?file=/index.js

- Add a row and leave it empty (to have failing validation in the array element).
- Type something in the company field outside the array
- `onChange` of the FormSpy that is only subscribed to `errors` fires on every keypress in that field as long as the array contains any errors

Combined with a setState in the onChange callback this can easily result in a react update loop freezing the app.

Expected behavior: onChange only triggering when there's an actual change.

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.