Skip to content

Commit

Permalink
fix(web): "v4" drs breaking due to infinite props updates (#2189)
Browse files Browse the repository at this point in the history
* fix(web): drs breaking due to infinite props updates

* fix(web): check on end prop to set null
  • Loading branch information
mohdashraf010897 authored Mar 15, 2023
1 parent 908757a commit dde895a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/web/src/components/range/DynamicRangeSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ class DynamicRangeSlider extends Component {
);
if (props.range) {
// always keep the values within range
// props.range.start / (props.queryFormat !== dateFormats.epoch_second ? 1 : 1000) is required
// props.range.start
// (props.queryFormat !== dateFormats.epoch_second ? 1 : 1000) is required
// since we need to convert the milliseconds value into seconds in case of epoch_second
normalizedValue = [
processedStart < props.range.start ? props.range.start : processedStart,
Expand Down Expand Up @@ -632,7 +633,12 @@ class DynamicRangeSlider extends Component {
}

render() {
if (!this.state.currentValue || !this.state.range || this.props.range.start === null) {
if (
!this.state.currentValue
|| !this.state.range
|| this.props.range === null
|| this.props.range.start === null
) {
return null;
}

Expand Down Expand Up @@ -787,6 +793,10 @@ const mapStateToProps = (state, props) => {
}
if (range) {
range = formatRange(range);
// eslint-disable-next-line no-restricted-globals
if (isNaN(range.start) && isNaN(range.end)) {
range = null;
}
}
return {
options,
Expand Down

0 comments on commit dde895a

Please sign in to comment.