From 0b9134ab19f0d691cf9c7646d22a4a756150c9f1 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Fri, 13 Dec 2024 15:24:02 +0100 Subject: [PATCH] fix: Math.max crashes if too many deltas --- tools/oversight/slicer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/oversight/slicer.js b/tools/oversight/slicer.js index f9a826b5..890300b2 100644 --- a/tools/oversight/slicer.js +++ b/tools/oversight/slicer.js @@ -71,7 +71,8 @@ dataChunks.addSeries('timeOnPage', (bundle) => { if (deltas.length === 0) { return undefined; } - return Math.max(...deltas) / 1000; + // get max delta and divide by 1000 to get seconds + return (deltas.reduce((a, b) => Math.max(a, b), -Infinity)) / 1000; }); dataChunks.addSeries('contentEngagement', (bundle) => {