Skip to content

Commit

Permalink
Memoize options getters in boxplot viz (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfalke authored May 17, 2023
1 parent d9828d5 commit a0c181e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,16 @@ function BoxplotViz(props: VisualizationProps<Options>) {

const findEntityAndVariable = useFindEntityAndVariable(filters);

const providedXAxisVariable = options?.getXAxisVariable?.(
computation.descriptor.configuration
const { getXAxisVariable, getComputedYAxisDetails } = options ?? {};
const { configuration: computeConfig } = computation.descriptor;

const providedXAxisVariable = useMemo(
() => getXAxisVariable?.(computeConfig),
[computeConfig, getXAxisVariable]
);
const computedYAxisDetails = options?.getComputedYAxisDetails?.(
computation.descriptor.configuration
const computedYAxisDetails = useMemo(
() => getComputedYAxisDetails?.(computeConfig),
[computeConfig, getComputedYAxisDetails]
);

// When we only have a computed y axis (and no provided x axis) then the y axis var
Expand Down

0 comments on commit a0c181e

Please sign in to comment.