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

focus last after fields.push() not possible, because no possibility to focus on callback

Open
#70 4 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
210
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Hello, I have 1 suggestion, when I push value, can't focus new element, because it is not created yet

```javascript
fields.push({id: '', name: '', lastName: ''})
setTimeout(()=>{
form.focus(`persons[${fields.value.length}].id`)
},200)
```

this is how it works now, but obviously, its really bad solution, if fields.push had a callback, it would be nice

just wondering, why fields.push acts like async?

Contributor guide

Open the contributing guide

Research direction

The issue provides no file or test names. Start by locating the fields.push entry point and tracing when the new array field is created, then review the surrounding API and lifecycle behavior before deciding how a callback could be supported. Done should allow callers to focus the new field without relying on setTimeout, with tests covering the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.