Skip to content

Commit

Permalink
fix: Math.max crashes if too many deltas (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
kptdobe authored Dec 13, 2024
1 parent 67c1a3d commit fc11ecd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/oversight/slicer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit fc11ecd

Please sign in to comment.