foxhound87 / mobx-react-form

Reactive MobX Form State Management
https://foxhound87.github.io/mobx-react-form
MIT License
1.09k stars 129 forks source link

Update field in a no-fallback form with array value should not create fields for the array items #614

Closed riceyeh closed 1 year ago

riceyeh commented 1 year ago

Hi, The following test shows fields for array items are created when update a field in a no-fallback form with array value:

` describe.only('no fallback', () => { it('no new field for array value', () => { const fields = ['prop'] const values = { prop: [1, 2, 3] } const form = new Form({fields, values}, {name: 'Form without fallback', options: {fallback: false}})

    expect(form.select('prop.0',undefined, false)).to.be.undefined // <--- fail

    expect(form.$('prop').value).to.deep.equal([1, 2, 3])
    form.update({prop: [4, 5, 6]})
    expect(form.select('prop.0', undefined, false)).to.be.undefined
    expect(form.$('prop').value).to.deep.equal([4, 5, 6])
})

}) `