From d0049e70b53d982176937f2e93bce601504a8dd4 Mon Sep 17 00:00:00 2001 From: Yan <75355375+yancat160@users.noreply.github.com> Date: Fri, 8 May 2026 09:35:09 -0400 Subject: [PATCH] explicitly reset ds.hidden in the hiddenLabels block Address Greptile P1 review on PR #4259. The hiddenLabels loop only wrote ds.hidden = true and never reset to false when a label was removed from the set. Toggle-off worked today only because the focusLabel block above ran first and unconditionally cleared all ds.hidden when focusLabel was falsy. That block is guarded by chartData.focusLabel !== null, so any caller passing focusLabel={null} would skip the reset and leave a stale true on reused dataset objects across effect re-runs, making un-hide silently fail. Add an else-if branch to the hiddenLabels loop that resets ds.hidden to false when the label is not in the set and no focusLabel is active. Behavior is unchanged for EventsChart (which never passes a null focusLabel) and the contract of the new props is now independent of execution order. --- src/components/charts/Chart.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/charts/Chart.tsx b/src/components/charts/Chart.tsx index 6fe167690..5ac44273a 100644 --- a/src/components/charts/Chart.tsx +++ b/src/components/charts/Chart.tsx @@ -131,6 +131,10 @@ export function Chart({ chart.current.data.datasets.forEach((ds: { hidden: boolean; label: any }) => { if (hiddenLabels.has(ds.label)) { ds.hidden = true; + } else if (!chartData.focusLabel) { + // Explicitly reset so un-hiding a label is always reflected, + // regardless of whether the focusLabel pass ran above. + ds.hidden = false; } }); }