diff --git a/CHANGELOG.md b/CHANGELOG.md index 539f4ebe0..1a1cbbb0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,7 @@ ## Not released -- onStateChange callback for range widget [#890](https://github.com/CartoDB/carto-react/pull/890) -- fix LegendWidget update logic for multiple legends case [#889](https://github.com/CartoDB/carto-react/pull/889) -- onStateChange callback for all widgets [#886](https://github.com/CartoDB/carto-react/pull/886) +- fix legend widget return bug [#893](https://github.com/CartoDB/carto-react/pull/893) ## 3.0.0 diff --git a/packages/react-widgets/src/widgets/LegendWidget.js b/packages/react-widgets/src/widgets/LegendWidget.js index 085fd9832..7a12412e2 100644 --- a/packages/react-widgets/src/widgets/LegendWidget.js +++ b/packages/react-widgets/src/widgets/LegendWidget.js @@ -19,7 +19,7 @@ function LegendWidget({ customLegendTypes, initialCollapsed, layerOrder = [], ti const dispatch = useDispatch(); const reduxLayers = useSelector((state) => state.carto.layers); const layers = useMemo(() => { - sortLayers( + return sortLayers( Object.values(reduxLayers).filter((layer) => !!layer.legend), layerOrder ).filter((l) => !!l.legend);