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

uniforms-antd multi-select gives issue caused by empty string in array #199

Closed
Gervwyk opened this issue Feb 16, 2017 · 2 comments
Closed
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@Gervwyk
Copy link
Contributor

Gervwyk commented Feb 16, 2017

When using a multi-select on antd theme. The field renders fine but when a model is given through Autoform and then cleared it gives (pass no / empty model):
Uncaught Error: must set key for <rc-animate> children
After debugging, I think this is related to this issue.

I think that it is cause by this line:
https://github.com/vazco/uniforms/blob/master/packages/uniforms-antd/src/SelectField.js#L52
which should not pass empty string in array.

Not sure what would be the best fix, but think it should be filtered in the select field.

@Gervwyk Gervwyk changed the title uniforms-antd multi-select gives issue on empty string uniforms-antd multi-select gives issue caused by empty string in array Feb 16, 2017
@radekmie radekmie self-assigned this Feb 16, 2017
@radekmie radekmie added the Type: Bug Bug reports and their fixes label Feb 16, 2017
@radekmie
Copy link
Contributor

@Gervwyk what do you think about:

-value={Array.isArray(props.value) ? props.value : '' + props.value}
+value={props.fieldType === Array ? props.value || [] : '' + (props.value || '')}

@Gervwyk
Copy link
Contributor Author

Gervwyk commented Feb 16, 2017

Logically looks like a good fix..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

2 participants