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

empty strings in array aren't preserved on values() #544

Closed
SangilYun opened this issue May 20, 2020 · 2 comments
Closed

empty strings in array aren't preserved on values() #544

SangilYun opened this issue May 20, 2020 · 2 comments

Comments

@SangilYun
Copy link

SangilYun commented May 20, 2020

Version
"mobx-react": "5.4.3",
"mobx-react-form": "1.35.1",

Example 1

const fields = {
    testField: ['', ''],
  };

const form = new MobxReactForm({ fields });
console.log('test form values', form.values()); //returns {testField:[]}

Example 2

const fields = {
    testField: ['', '1', ''],
  };

const form = new MobxReactForm({ fields });
console.log('test form values', form.values()); //returns {testField:['1']}

I was expecting Example 1 would return {testField: ['', '']} and Example 2 return {testField: ['', '1', '']}, but it seems like empty strings get trimmed out when the values function is called

how can I keep the empty strings?

@foxhound87
Copy link
Owner

I will work on a form option to handle and keep both cases

@foxhound87
Copy link
Owner

removeNullishValuesInArrays form option has been introduced in 5.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants