From 264850cbebb6b557f834cae8b9be0ddeaae11a4a Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Fri, 6 Sep 2024 13:58:55 +0200 Subject: [PATCH] refactor: Move dimensions to second useMemo --- .../shared/use-combined-temporal-dimension.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/charts/shared/use-combined-temporal-dimension.ts b/app/charts/shared/use-combined-temporal-dimension.ts index e0c6c26ac..d499a9c36 100644 --- a/app/charts/shared/use-combined-temporal-dimension.ts +++ b/app/charts/shared/use-combined-temporal-dimension.ts @@ -31,13 +31,10 @@ export const useCombinedTemporalDimension = () => { locale, }, }); - const dimensions = useMemo( - () => data?.dataCubesComponents.dimensions ?? [], - [data?.dataCubesComponents.dimensions] - ); - return useMemo(() => { - const timeUnitDimensions = dimensions.filter( + const timeUnitDimensions = ( + data?.dataCubesComponents.dimensions ?? [] + ).filter( (dimension) => isTemporalDimensionWithTimeUnit(dimension) && potentialTimeRangeFilterIris.includes(dimension.iri) @@ -83,5 +80,9 @@ export const useCombinedTemporalDimension = () => { }; return combinedDimension; - }, [dimensions, formatLocale, potentialTimeRangeFilterIris]); + }, [ + data?.dataCubesComponents.dimensions, + formatLocale, + potentialTimeRangeFilterIris, + ]); };