Skip to content

Commit

Permalink
fix: animations in Category Widget (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdriSolid committed Mar 10, 2021
1 parent cf2d821 commit 05caca7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fix viewportFeatures with empty tiles [#100](https://github.com/CartoDB/carto-react-lib/pull/100)
- Fix viewportFeatures mode in PieWidget when using viewportFilter [#102](https://github.com/CartoDB/carto-react-lib/pull/102)
- BREAKING: Refactor into a new **multi-package** project [#104](https://github.com/CartoDB/carto-react-lib/pull/104)
- Fix animations in Category Widget [#108](https://github.com/CartoDB/carto-react-lib/pull/108)

## 1.0.0-beta14 (2021-02-08)

Expand Down
6 changes: 5 additions & 1 deletion packages/react-ui/src/widgets/CategoryWidgetUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function CategoryWidgetUI(props) {
const [animValues, setAnimValues] = useState([]);
const requestRef = useRef();
const prevAnimValues = usePrevious(animValues);
const referencedPrevAnimValues = useRef(prevAnimValues);
const referencedPrevAnimValues = useRef();
const classes = useStyles();

// Get blockedCategories in the same order as original data
Expand Down Expand Up @@ -332,6 +332,10 @@ function CategoryWidgetUI(props) {
showAll
]);

useEffect(() => {
referencedPrevAnimValues.current = prevAnimValues;
}, [prevAnimValues]);

useEffect(() => {
animateValues({
start: referencedPrevAnimValues.current || [],
Expand Down

0 comments on commit 05caca7

Please sign in to comment.