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

FormSpy onChange with subscription on dirty, not registering the first letter in input fields

Open
#507 1 comment 1 reaction 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 report

### What is the current behavior?

We are using FormSpy, subscribed to dirty. OnChange function in the FormSpy will update the dirty tag in redux, when dirty is true. When I type in any input field, the first letter doesn't show up, but the redux state is updated with `dirty:true` on the first letter stroke.

Also form is written in a different file using
```

```
This is how we used FormSpy
```
this.updateDirty(state.dirty)}
{...props}
/>

updateDirty(isDirty) {
const { toggleIsDirty, dirtyState } = this.props;
if (isDirty) {
if (!dirtyState.isDirty) {
toggleIsDirty();
}
}
}
```
When the `if (isDirty)` check is not done, it keeps updating the store value, but doesn't show anything in the input field.
Where did we go wrong?

### Other information

https://stackoverflow.com/questions/56384922/formspy-onchange-with-subscription-on-dirty-is-not-showing-values-in-input-fie

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.