-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Testing environment
- OS: Archlinux 5.0.0 x86_64 | Archlinux 5.0.1 x86_64
- NPM: v6.4.1 | v6.7.0 | v6.9.0
- node: v10.15.3 | v11.11.0
- react-advanced-form: v1.5.* | v1.6.7
- Browser: Google Chrome (working but not always) | Firefox (not working at all)
What
Current Behaviour
- Provide a Form component with a Select field component (created with
createField) and usingReact-Selectcomponent. This select field is multiple. - Select one of the available values
- The field is updated and renders the selected value
- Select additional values
- The field is not updated and ignores the selected values
Expected Behaviour
- The field should not ignore additional values
Investigation result
- When an additional value is selected
Form.validateFieldis called (line 488).
See here
Here, forceProps is always false.
On Chrome:
const fields = explicitFields || this.state.fields
let fieldProps = forceProps
? explicitFieldProps
: R.path(explicitFieldProps.fieldPath, fields)
// This branch is always taken in my case
if (fieldProps) {
console.log(fieldProps.value)
// -> Array of two values (IMO, this means that the field values were
// updated BEFORE the validation...)
}
fieldProps = fieldProps || explicitFieldPropsOn Firefox:
const fields = explicitFields || this.state.fields
let fieldProps = forceProps
? explicitFieldProps
: R.path(explicitFieldProps.fieldPath, fields)
// This branch is always taken in my case
if (fieldProps) {
console.log(fieldProps.value)
// -> One value (IMO, this means that the field values were not
// updated, kinda logical because validation should allows it or not)
}
fieldProps = fieldProps || explicitFieldPropsMore
I was not able to reproduce the problem on Debian unstable (my only other testing environment).
Here's a code sandbox (See here) showing the bug I have on Archlinux with Firefox.
On the sandbox, I can't even select a single value and the bug also happens when the isMulti = false.
Resolution
I don't really understand why you are using R.path(explicitFieldProps.fieldPath, fields).
I tried removing the line and it works (same as setting forceProps to true).
Metadata
Metadata
Assignees
Labels
No labels