diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee369ccb..49695dc55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Not released - Fix CategoryWidget values during animation [#230](https://github.com/CartoDB/carto-react/pull/230) +- Remove lock in CategoryWidget if selected categories change [#231](https://github.com/CartoDB/carto-react/pull/231) ## 1.1.1 (2021-11-23) diff --git a/packages/react-redux/src/slices/cartoSlice.d.ts b/packages/react-redux/src/slices/cartoSlice.d.ts index 057388388..97b3a6e97 100644 --- a/packages/react-redux/src/slices/cartoSlice.d.ts +++ b/packages/react-redux/src/slices/cartoSlice.d.ts @@ -104,7 +104,7 @@ export function setBasemap( export function addFilter( filter: Filter ): { - type: CartoActions.ADD_LAYER; + type: CartoActions.ADD_FILTER; payload: Filter; }; diff --git a/packages/react-ui/src/widgets/CategoryWidgetUI.js b/packages/react-ui/src/widgets/CategoryWidgetUI.js index 3c79dff34..c851a1912 100644 --- a/packages/react-ui/src/widgets/CategoryWidgetUI.js +++ b/packages/react-ui/src/widgets/CategoryWidgetUI.js @@ -300,6 +300,12 @@ function CategoryWidgetUI(props) { [maxValue] ); + useEffect(() => { + if (selectedCategories.length === 0) { + setBlockedCategories([]); + } + }, [selectedCategories]); + useEffect(() => { if (data) { // Ranking