Fix issue with large timestamp arrays (#35)

* 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 <33317356+villebro@users.noreply.github.com>

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
sowo 2021-08-05 09:24:54 +02:00 committed by Yongjie Zhao
parent 9b8524c7b1
commit f0369fda6e
2 changed files with 5 additions and 2 deletions

View File

@ -130,6 +130,9 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
points: props.getPoints(features),
});
}
if (viewport.zoom < 0) {
viewport.zoom = 0;
}
return {
start,

View File

@ -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;