mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard/RefreshPicker: Prevents unnecessary redrawing of RefreshPicker (#26902)
Closes #26823
This commit is contained in:
parent
eb985ffbee
commit
e4da0fcb5e
@ -64,6 +64,22 @@ export class RefreshPickerBase extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
shouldComponentUpdate(nextProps: Props) {
|
||||||
|
const intervalsDiffer = nextProps.intervals?.some((interval, i) => this.props.intervals?.[i] !== interval);
|
||||||
|
|
||||||
|
return (
|
||||||
|
intervalsDiffer ||
|
||||||
|
this.props.onRefresh !== nextProps.onRefresh ||
|
||||||
|
this.props.onIntervalChanged !== nextProps.onIntervalChanged ||
|
||||||
|
this.props.value !== nextProps.value ||
|
||||||
|
this.props.tooltip !== nextProps.tooltip ||
|
||||||
|
this.props.hasLiveOption !== nextProps.hasLiveOption ||
|
||||||
|
this.props.refreshButton !== nextProps.refreshButton ||
|
||||||
|
this.props.buttonSelectClassName !== nextProps.buttonSelectClassName ||
|
||||||
|
this.props.theme !== nextProps.theme
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { onRefresh, intervals, tooltip, value, refreshButton, buttonSelectClassName, theme } = this.props;
|
const { onRefresh, intervals, tooltip, value, refreshButton, buttonSelectClassName, theme } = this.props;
|
||||||
const options = this.intervalsToOptions(intervals);
|
const options = this.intervalsToOptions(intervals);
|
||||||
|
Loading…
Reference in New Issue
Block a user