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

Calling mutator inside FormSpy.onChange generates React.setState warnings

Open
#211 3 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!

### What is the current behavior?

When you trigger a mutator within FormSpy.onChange, it will throw a few setState warnings on mount

### What is the expected behavior?

Bunnies.

### Sandbox Link

Example: https://codesandbox.io/s/qvvn0zr5oq

### Other information

What I am trying to accomplish is form re-population. I would like to fill in the form with previous values if a user refreshes the page, or temporarily navigates away. I can't use `initialValues`, since I still want the form to be able to reset back to its pristine state.

I figured I would make a mutator that just populates, but now I came across the `initialize` function.. and now I'm seeing your "Load, Save, Reinitialize" example... sooo I'm going to explore those options.

However, this still seems to be a bug..?

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.