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

useFormState effect doesn't depend on onChange callback

Open
#561 2 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 report

### What is the current behavior?

`onChange` callback doesn't update when it updates in `FormSpy` component.

### What is the expected behavior?

`useFormState` effect should [depend](https://github.com/final-form/react-final-form/blob/master/src/useFormState.js#L42) on `onChange` callback.

### Sandbox Link

https://codesandbox.io/s/react-final-form-simple-example-d8www?fontsize=14

Steps to reproduce:
1. Enter some text
2. Increment ID
3. Enter some text and look into PRE, it doesn't update

### What's your environment?

I use React Native, but the issue persists on Code Sandbox as well.

```
info
React Native Environment Info:
System:
OS: macOS 10.14.4
Memory: 107.81 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: ^0.59.1 => 0.59.4
npmGlobalPackages:
react-native-cli: 2.0.1
```

Final Form: 4.16.1
React Final Form: 6.3.0

### Other information

I'm not sure it's a bug. If it is, I will submit a pull request.

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.