jaredpalmer / jaredpalmer/formik

A way to keep backend errors with client validation

Open
#150 32 comments 44 reactions 0 assignees View on GitHub
pinned Type: Enhancement
Dominant language
TypeScript
Stars
34.3k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

Here is a simple form with errors example:

```
name - no error
surname - no error
```

When I submit form, I receive backend errors: `{ surname: 'Exists' }`. So, I set field errors and now they are:

```
name - no error
surname - 'Exists'
```

Now, if I change or blur the value of the `name` field, the whole form validation will be triggered and backend error will be erased for `surname` field.

How is it possible to erase field's backend error only if the value of that field was changed?

I can think of possible solution with using form's `status` to save backend errors, checking the field's previous/new value, but it feels like a really big hack.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by tracing Formik's form and field validation flow, then reproduce the example to determine how backend errors are stored and cleared; done means changing or blurring one field preserves another field's backend error while changing that field clears its own error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.