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

OnChange leads to "ghost data" appearing in field

Open
#25 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
95
Forks
21
PR merge metrics
No merged PRs in 30d

Description

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

Bug Report

### What is the current behavior?

I have a field, `a`. Depending on the value of `a`, another field, `b`, appears. Additionally, when changing `a`, we need to change the value of `b` as well (either setting it or clearing it out). It's possible to get the value of `b` to read one thing, even though its value in the form state is something else. When you focus field `b` it snaps to that other value, seemingly indicating that it didn't rerender after its value changed (?)

![CleanShot 2020-08-27 at 17 19 57](https://user-images.githubusercontent.com/129633/91496115-9b300300-e889-11ea-936c-a22b147546a9.png)

### What is the expected behavior?

`` should work the same as the `useEffect` hook I commented out in the file. if you use that instead of ``, it works as I'd expect: the data in the form values should match the data reflected in the form field itself.

### Sandbox Link

https://codesandbox.io/s/ecstatic-kare-2jcts?file=/target.js

### What's your environment?

See sandbox: newest everything

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.