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

support Field without name

Open
#535 0 comments 8 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**?

feature request

### What is the current behavior?

I'm working with a lot of "partial forms", these are React components I can provide to a Field component property. They have nested Field components.

When I use these to handle nested structure of my form it's all working well. but if I want it to be my whole form (not nested under a property) I would need to provide it to a Field without a name.

example as a nested property:

ListOfItems.form.jsx:
```

```

Item.form.jsx:
```

```

In Item.form.jsx partialForm is in fact the whole form.

This works pretty well until you try to unmount the component, I get this error:

```
Uncaught Error: Cannot call setIn() with undefined key
at setIn (final-form.es.js:162)
at Field.unsubscribe (final-form.es.js:1062)
at Field.componentWillUnmount (react-final-form.es.js:280)
```

### What is the expected behavior?

I'd like a way to use name="." or something to tell final-final the component will work with the whole dataset of the form. Is there already a way to do it maybe ?

### Sandbox Link

The example seems a bit dumb but it reproduce the error as soon as you uncheck the checkbox
https://codesandbox.io/s/react-final-form-simple-example-wlbqz?fontsize=14

(fork of final form simple example)

### What's your environment?

final-form@4.13.0
final-form-arrays@1.1.2
react-final-form@4.1.0
react-final-form-arrays@2.0.3

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.