diff --git a/public/app/features/explore/LogLabels.tsx b/public/app/features/explore/LogLabels.tsx index eb9c39050f6..8aa1789017e 100644 --- a/public/app/features/explore/LogLabels.tsx +++ b/public/app/features/explore/LogLabels.tsx @@ -69,7 +69,7 @@ export class Stats extends PureComponent<{ class Label extends PureComponent< { - allRows?: LogRow[]; + getRows?: () => LogRow[]; label: string; plain?: boolean; value: string; @@ -98,13 +98,14 @@ class Label extends PureComponent< if (state.showStats) { return { showStats: false, stats: null }; } - const stats = calculateLogsLabelStats(this.props.allRows, this.props.label); + const allRows = this.props.getRows(); + const stats = calculateLogsLabelStats(allRows, this.props.label); return { showStats: true, stats }; }); }; render() { - const { allRows, label, plain, value } = this.props; + const { getRows, label, plain, value } = this.props; const { showStats, stats } = this.state; const tooltip = `${label}: ${value}`; return ( @@ -115,12 +116,12 @@ class Label extends PureComponent< {!plain && ( )} - {!plain && allRows && } + {!plain && getRows && } {showStats && ( LogRow[]; labels: LogsStreamLabels; plain?: boolean; onClickLabel?: (label: string, value: string) => void; }> { render() { - const { allRows, labels, onClickLabel, plain } = this.props; + const { getRows, labels, onClickLabel, plain } = this.props; return Object.keys(labels).map(key => ( -