From 71c96b01d1b7ee51f62c85d07d5d55debe4ca843 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Mon, 6 Jan 2025 15:39:16 +0100 Subject: [PATCH 1/4] fix: Re-mount the chart container when chart type changes ...to prevent issues with useSize that gets a wrong size from a previous chart when changing chart type that results in scrollable containers. --- app/charts/shared/containers.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/charts/shared/containers.tsx b/app/charts/shared/containers.tsx index f5749d91b..6a7810d20 100644 --- a/app/charts/shared/containers.tsx +++ b/app/charts/shared/containers.tsx @@ -7,6 +7,7 @@ import { useChartState } from "@/charts/shared/chart-state"; import { CalculationToggle } from "@/charts/shared/interactive-filter-calculation-toggle"; import { useObserverRef } from "@/charts/shared/use-size"; import { + getChartConfig, hasChartConfigs, isLayoutingFreeCanvas, useConfiguratorState, @@ -25,12 +26,15 @@ export const useStyles = makeStyles<{}, {}, "chartContainer">(() => ({ export const ChartContainer = ({ children }: { children: ReactNode }) => { const [state] = useConfiguratorState(hasChartConfigs); + const chartConfig = getChartConfig(state); const isFreeCanvas = isLayoutingFreeCanvas(state); const ref = useObserverRef(); const { bounds } = useChartState(); const classes = useStyles(); + return (