From dcb3b329b22bd63c9eb21e375b4ba1d455825cde Mon Sep 17 00:00:00 2001 From: Jaret Burkett Date: Mon, 13 Jul 2026 17:10:38 -0600 Subject: [PATCH] Fix issue with the graph with sparse data when shrinking smoothing --- ui/src/components/JobLossGraph.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/src/components/JobLossGraph.tsx b/ui/src/components/JobLossGraph.tsx index 2ef2057..73f4713 100644 --- a/ui/src/components/JobLossGraph.tsx +++ b/ui/src/components/JobLossGraph.tsx @@ -343,8 +343,17 @@ export default function JobLossGraph({ job }: Props) { distr: useLogScale ? 3 : 1, range: (_u, dataMin, dataMax) => { const c = yClipRef.current?.[scaleKey]; - if (c) return [c.min, c.max]; - return [dataMin, dataMax]; + const min = c ? c.min : dataMin; + const max = c ? c.max : dataMax; + if (min == null || max == null) return [null, null]; + // uPlot's log tick generator (logAxisSplits) assumes the scale min + // sits on a magnitude boundary — its default log range snaps via + // rangeLog before ticks are computed. Handing it raw data extents + // can wedge its split loop into an endless push (RangeError: + // Invalid array length + frozen UI) when the min lands just below + // a power of 10. Snap the same way uPlot's default does. + if (useLogScale) return uPlot.rangeLog(min, max, 10, false); + return [min, max]; }, };