GraphNG: fix crash when trying to diff missing timeRange prop (#38654)

This commit is contained in:
Leon Sorokin 2021-08-27 12:40:33 -05:00 committed by GitHub
parent 1be53b4f3b
commit 4e2516d12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,11 @@ function sameConfig(prevProps: PlotProps, nextProps: PlotProps) {
function sameTimeRange(prevProps: PlotProps, nextProps: PlotProps) {
let prevTime = prevProps.timeRange;
let nextTime = nextProps.timeRange;
return nextTime.from.valueOf() === prevTime.from.valueOf() && nextTime.to.valueOf() === prevTime.to.valueOf();
return (
prevTime === nextTime ||
(nextTime.from.valueOf() === prevTime.from.valueOf() && nextTime.to.valueOf() === prevTime.to.valueOf())
);
}
type UPlotChartState = {