Skip to content

Commit

Permalink
refactor: Move dimensions to second useMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Sep 6, 2024
1 parent 434702c commit 264850c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/charts/shared/use-combined-temporal-dimension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -83,5 +80,9 @@ export const useCombinedTemporalDimension = () => {
};

return combinedDimension;
}, [dimensions, formatLocale, potentialTimeRangeFilterIris]);
}, [
data?.dataCubesComponents.dimensions,
formatLocale,
potentialTimeRangeFilterIris,
]);
};

0 comments on commit 264850c

Please sign in to comment.