Skip to content

Commit dde895a

Browse files
fix(web): "v4" drs breaking due to infinite props updates (#2189)
* fix(web): drs breaking due to infinite props updates * fix(web): check on end prop to set null
1 parent 908757a commit dde895a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/web/src/components/range/DynamicRangeSlider.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ class DynamicRangeSlider extends Component {
440440
);
441441
if (props.range) {
442442
// always keep the values within range
443-
// props.range.start / (props.queryFormat !== dateFormats.epoch_second ? 1 : 1000) is required
443+
// props.range.start
444+
// (props.queryFormat !== dateFormats.epoch_second ? 1 : 1000) is required
444445
// since we need to convert the milliseconds value into seconds in case of epoch_second
445446
normalizedValue = [
446447
processedStart < props.range.start ? props.range.start : processedStart,
@@ -632,7 +633,12 @@ class DynamicRangeSlider extends Component {
632633
}
633634

634635
render() {
635-
if (!this.state.currentValue || !this.state.range || this.props.range.start === null) {
636+
if (
637+
!this.state.currentValue
638+
|| !this.state.range
639+
|| this.props.range === null
640+
|| this.props.range.start === null
641+
) {
636642
return null;
637643
}
638644

@@ -787,6 +793,10 @@ const mapStateToProps = (state, props) => {
787793
}
788794
if (range) {
789795
range = formatRange(range);
796+
// eslint-disable-next-line no-restricted-globals
797+
if (isNaN(range.start) && isNaN(range.end)) {
798+
range = null;
799+
}
790800
}
791801
return {
792802
options,

0 commit comments

Comments
 (0)