diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx index 9a815df..4ecd870 100644 --- a/src/components/Dashboard/Dashboard.tsx +++ b/src/components/Dashboard/Dashboard.tsx @@ -15,16 +15,16 @@ export default function Dashboard(props: DashboardProps) { event: React.MouseEvent, newFlow: "outflows" | "inflows" | null ) => { - if (newFlow !== null && newFlow !== state.flow) { - setState(prev => { - const next = { - ...prev, - flow: newFlow, - }; - props.onFlowChange?.(next); - return next; - }); - } + if (newFlow === null) return; + + setState(prev => { + if (prev.flow === newFlow) return prev; + + const next = { ...prev, flow: newFlow }; + props.onFlowChange?.(next); + + return next; + }); }; const togglePeriodType = () => {