Skip to content

Commit

Permalink
Fix issue with large timestamp arrays (#35)
Browse files Browse the repository at this point in the history
* Fix issue with large timestamp arrays

Math.max and Math.min produce "Maximum call stack size exceeded" errors when used with large arrays (see: https://stackoverflow.com/questions/18308700/chrome-how-to-solve-maximum-call-stack-size-exceeded-errors-on-math-max-apply)

* fix issue when viewport.zoom < 0

* Update packages/superset-ui-legacy-preset-chart-deckgl/src/utils/time.js

Sure. Style changed

Co-authored-by: Ville Brofeldt <[email protected]>

Co-authored-by: Ville Brofeldt <[email protected]>
  • Loading branch information
2 people authored and zhaoyongjie committed Nov 30, 2021
1 parent 9b8524c commit f0369fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
points: props.getPoints(features),
});
}
if (viewport.zoom < 0) {
viewport.zoom = 0;
}

return {
start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function getStepSeconds(step, start) {
}

export function getPlaySliderParams(timestamps, timeGrain) {
const minTimestamp = moment(Math.min(...timestamps));
const maxTimestamp = moment(Math.max(...timestamps));
const minTimestamp = moment(Number(timestamps.reduce((a,b) => a < b ? a : b)));
const maxTimestamp = moment(Number(timestamps.reduce((a,b) => a > b ? a : b)));
let step;
let reference;

Expand Down

0 comments on commit f0369fd

Please sign in to comment.