Skip to content

The open alternative to Salesforce, designed for AI.

Remove debounced chart resize (#17376)

Raphaël Bosi23798ddc6b1b
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx
index b594e7f00e8..7b0d7a4f7fe 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx
@@ -108,15 +108,6 @@ export const GraphWidgetBarChart = ({
const [chartHeight, setChartHeight] = useState<number>(0);
const containerRef = useRef<HTMLDivElement>(null);
- const debouncedSetChartDimensions = useDebouncedCallback(
- (width: number, height: number) => {
- setChartWidth(width);
- setChartHeight(height);
- },
-
- 300,
- );
-
const setActiveBarTooltip = useSetRecoilComponentState(
graphWidgetBarTooltipComponentState,
);
@@ -363,7 +354,8 @@ export const GraphWidgetBarChart = ({
<NodeDimensionEffect
elementRef={containerRef}
onDimensionChange={({ width, height }) => {
- debouncedSetChartDimensions(width, height);
+ setChartWidth(width);
+ setChartHeight(height);
}}
/>
<ResponsiveBar
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx
index 728a7e86124..df2182c99a5 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx
@@ -97,11 +97,6 @@ export const GraphWidgetLineChart = ({
const containerRef = useRef<HTMLDivElement>(null);
const [chartWidth, setChartWidth] = useState(0);
- const debouncedSetChartWidth = useDebouncedCallback(
- (width: number) => setChartWidth(width),
- 300,
- );
-
const formatOptions: GraphValueFormatOptions = {
displayType,
decimals,
@@ -291,7 +286,7 @@ export const GraphWidgetLineChart = ({
>
<NodeDimensionEffect
elementRef={containerRef}
- onDimensionChange={({ width }) => debouncedSetChartWidth(width)}
+ onDimensionChange={({ width }) => setChartWidth(width)}
/>
<ResponsiveLine
data={nivoData}