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

multiple is not passed down to custom components #544

Closed
ThiefMaster opened this issue Jun 21, 2019 · 4 comments · Fixed by #545
Closed

multiple is not passed down to custom components #544

ThiefMaster opened this issue Jun 21, 2019 · 4 comments · Fixed by #545

Comments

@ThiefMaster
Copy link
Contributor

ThiefMaster commented Jun 21, 2019

I'm using the Dropdown from semantic-ui-react. Just like a normal multiselect dropdown it requires the multiple prop to enable multiselect mode.

However, the Field component passes multiple only to useField() but not along with the other props to the component. For <select multiple> this is handled correctly in useField() (input.multiple = true), but if component is something custom, then this prop is lost.

Would it make sense to always forward multiple, assuming that if it's specified the input (whatever it is) knows how to handle it? It doesn't seem to make sense to set multiple without passing it down, since useField only takes it into account for select components.

ThiefMaster added a commit to ThiefMaster/indico that referenced this issue Jun 21, 2019
Also support checkboxes with values (creating an array of all checked
values)

Fixed issues:

- undefined not being converted, resulting in uncontrolled/controlled
  transitions
- multiselect dropdown having a clear button (more likely caused by some
  SUIR update)
- `multiple` for multiselect dropdown being lost (final-form/react-final-form#544)
- don't convert empty strings to undefined for text fields
ThiefMaster added a commit to ThiefMaster/indico that referenced this issue Jun 21, 2019
Also support checkboxes with values (creating an array of all checked
values)

Fixed issues:

- undefined not being converted, resulting in uncontrolled/controlled
  transitions
- multiselect dropdown having a clear button (more likely caused by some
  SUIR update)
- `multiple` for multiselect dropdown being lost (final-form/react-final-form#544)
- don't convert empty strings to undefined for text fields
@erikras
Copy link
Member

erikras commented Jun 21, 2019

You could get around this by using a prop name other than multiple, but...

@ThiefMaster
Copy link
Contributor Author

yeah, that's the workaround i was using, but not having to do that is cleaner :p

ThiefMaster added a commit to ThiefMaster/indico that referenced this issue Jun 24, 2019
Also support checkboxes with values (creating an array of all checked
values)

Fixed issues:

- undefined not being converted, resulting in uncontrolled/controlled
  transitions
- multiselect dropdown having a clear button (more likely caused by some
  SUIR update)
- `multiple` for multiselect dropdown being lost (final-form/react-final-form#544)
- don't convert empty strings to undefined for text fields
ThiefMaster added a commit to ThiefMaster/indico that referenced this issue Jun 24, 2019
Also support checkboxes with values (creating an array of all checked
values)

Fixed issues:

- undefined not being converted, resulting in uncontrolled/controlled
  transitions
- multiselect dropdown having a clear button (more likely caused by some
  SUIR update)
- `multiple` for multiselect dropdown being lost (final-form/react-final-form#544)
- don't convert empty strings to undefined for text fields
@pulse00
Copy link

pulse00 commented Aug 19, 2019

@erikras i was stumbling on this too in one of our apps, can you clarify what the multiple FieldRenderProp is doing? I can't find it in the documentation (https://github.com/final-form/react-final-form/blob/master/docs/types/FieldRenderProps.md).

Happy to send an PR if you clarify what it does.

@erikras
Copy link
Member

erikras commented Nov 18, 2019

Published fix in v6.3.1.

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

Successfully merging a pull request may close this issue.

3 participants