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

useField throw error "Cannot read property 'active' of undefined"

Open
#884 2 comments 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**?

### What is the current behavior?
For lazy initial value's field, I'm using the useField for register filed after API loaded.
My code:

if (loading) return

```
Compo = (medias) => {
useField("attachmentFile", { initialValue: medias });
return null;
}
```

Error:

```
final-form.es.js:181 Uncaught (in promise) TypeError: Cannot read property 'active' of undefined
at publishFieldState (final-form.es.js:181)
at notifyField (final-form.es.js:739)
at notifyFieldListeners (final-form.es.js:750)
at notify (final-form.es.js:1082)
at afterPromise (final-form.es.js:712)
```

### What is the expected behavior?

### Sandbox Link
No

### What's your environment?
Ubuntu

### Other information

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.