Skip to content

Commit

Permalink
ui: fix linegraph render for large clusters
Browse files Browse the repository at this point in the history
We were feeding `Math.min` and `Math.max` very large arrays
(length equal to ~10e7). These functions take variadic arguments,
and the runtime can't handle that many arguments. As a result we
blow the stack, causing uncaught range errors.

Instead, we'll use lodash min and max which are not variadic.
Resolves #101377
Epic: None
Release note: None
  • Loading branch information
Zach Lite committed Apr 20, 2023
1 parent 06fea49 commit 9485400
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/ui/workspaces/cluster-ui/src/graphs/utils/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ export function calculateYAxisDomain(
data: number[],
): AxisDomain {
const allDatapoints = data.concat([0, 1]);
const yExtent = [
Math.min(...allDatapoints),
Math.max(...allDatapoints),
] as Extent;
const yExtent = [_.min(allDatapoints), _.max(allDatapoints)] as Extent;

switch (axisUnits) {
case AxisUnits.Bytes:
Expand Down

0 comments on commit 9485400

Please sign in to comment.