Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
riceyeh opened this issue Oct 3, 2022 · 0 comments

Comments

@riceyeh
Copy link
Contributor

riceyeh commented Oct 3, 2022

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])
})

})
`

riceyeh added a commit to riceyeh/mobx-react-form that referenced this issue Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants