diff --git a/CHANGELOG.md b/CHANGELOG.md index 6578d633d..1687cbd9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change history for stripes-smart-components +## 6.0.3 (IN PROGRESS) + +* Fix `` when using `` via final form. Fixes STSMACOM-500. + ## [6.0.2](https://github.com/folio-org/stripes-smart-components/tree/v6.0.2) (2021-04-15) [Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v6.0.1...v6.0.2) diff --git a/lib/CustomFields/pages/EditCustomFieldsRecord/EditCustomFieldsRecord.js b/lib/CustomFields/pages/EditCustomFieldsRecord/EditCustomFieldsRecord.js index c34b2e6ed..e9ec107fc 100644 --- a/lib/CustomFields/pages/EditCustomFieldsRecord/EditCustomFieldsRecord.js +++ b/lib/CustomFields/pages/EditCustomFieldsRecord/EditCustomFieldsRecord.js @@ -5,6 +5,7 @@ import { FormattedMessage, useIntl, } from 'react-intl'; +import { OnChange } from 'react-final-form-listeners'; import { chunk, @@ -207,13 +208,6 @@ const EditCustomFieldsRecord = ({ const getMultiSelectProps = customField => { if (customField.type === fieldTypes.MULTISELECT) { return { - onChange(form, values) { - if (!values.length) { - setIsValid(false); - } else { - setIsValid(true); - } - }, error: checkValid(customField) }; } @@ -238,6 +232,18 @@ const EditCustomFieldsRecord = ({ {...props} {...getMultiSelectProps(customField)} /> + { + customField.type === fieldTypes.MULTISELECT && + + {(values) => { + if (!values.length) { + setIsValid(false); + } else { + setIsValid(true); + } + }} + + } ) ); diff --git a/package.json b/package.json index aa7666b47..1be46f9e8 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "react-copy-to-clipboard": "^5.0.1", "react-final-form": "^6.3.0", "react-final-form-arrays": "^3.1.1", + "react-final-form-listeners": "^1.0.3", "react-query": "^3.9.8", "react-router-prop-types": "^1.0.4", "react-transition-group": "^2.4.0",