Commit e4da0fcb by kay delaney Committed by GitHub

Dashboard/RefreshPicker: Prevents unnecessary redrawing of RefreshPicker (#26902)

Closes #26823
parent eb985ffb
......@@ -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() {
const { onRefresh, intervals, tooltip, value, refreshButton, buttonSelectClassName, theme } = this.props;
const options = this.intervalsToOptions(intervals);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment