diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1837173..a541d536f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ * Avoid deprecated `defaultProps` for functional components. Refs STSMACOM-835. * Upgrade `notes` to `v4.0`. Refs STSMACOM-861. * Improve confirmation modal footer for `ControlledVocab` component. Refs STSMACOM-863. +* Fix `` validation errors disappear when another facet value changes. Fixes STSMACOM-860. ## [9.1.3](https://github.com/folio-org/stripes-smart-components/tree/v9.1.3) (2024-05-06) [Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v9.1.2...v9.1.3) diff --git a/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js b/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js index b6b585b76..2705be055 100644 --- a/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js +++ b/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js @@ -181,10 +181,12 @@ const TheComponent = ({ React.useEffect(() => { setFilterValue({ - ...getInitialValidationData(selectedValues, dateFormat, requiredFields), - selectedValues + ...getInitialValidationData(selectedValuesState, dateFormat, requiredFields), + selectedValues: selectedValuesState, }); - }, [selectedValues, dateFormat, requiredFields]); + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedValues.startDate, selectedValues.endDate, dateFormat, requiredFields]); return ( <>