diff --git a/ui/src/ifql/components/TimeMachineVis.tsx b/ui/src/ifql/components/TimeMachineVis.tsx index f05d0385ad..594afeb690 100644 --- a/ui/src/ifql/components/TimeMachineVis.tsx +++ b/ui/src/ifql/components/TimeMachineVis.tsx @@ -25,7 +25,7 @@ class TimeMachineVis extends PureComponent { } public componentDidUpdate(__, prevState) { - if (prevState.selectedResultID === null) { + if (!this.selectedResult) { this.setState({selectedResultID: this.initialResultID}) } } @@ -33,7 +33,7 @@ class TimeMachineVis extends PureComponent { public render() { return (
- {this.hasResults && ( + {this.showSidebar && ( { } } + private get showSidebar(): boolean { + return this.props.data.length > 1 + } + private get hasResults(): boolean { return !!this.props.data.length }