jaredpalmer / jaredpalmer/formik

FieldArray change triggers validation twice

Open
#2,170 4 comments 9 reactions 0 assignees View on GitHub
stale
Dominant language
TypeScript
Stars
34.3k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug report

### Current Behavior

When Field in FieldArray changed, the validate of Field was triggered twice.
Take a look into example in code sandbox.

### Expected behavior

Validation happens only once.

### Reproducible example

https://codesandbox.io/s/formik-fieldarray-change-validation-bug-8m6l4

### Suggested solution(s)

### Additional context

### Your environment

| Software | Version(s) |
| ---------------- | ---------- |
| Formik | 2.1.1
| React | 16.12.0
| TypeScript |
| Browser |
| npm/Yarn |
| Operating System |

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox reproduction using Formik 2.1.1 and React 16.12.0, then trace the FieldArray change and validation flow. Confirm where the field validation is triggered twice; done means the same change causes validation only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.