Explore: Improves performance of Logs element by limiting re-rendering (#17685)

* Explore: Improves performance of Logs element by limiting re-rendering
Re-renders only when query has finished executing or when deduplication
strategy changes.
Closes #17663

* Explore: Adds logsHighlighterExpressions as prop to consider when re-rendering Logs
This commit is contained in:
kay delaney 2019-06-20 12:56:47 +01:00 committed by GitHub
parent 6fd4aa4b46
commit 57dadebbd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,6 +91,16 @@ export class LogsContainer extends PureComponent<LogsContainerProps> {
return [];
};
// Limit re-rendering to when a query is finished executing or when the deduplication strategy changes
// for performance reasons.
shouldComponentUpdate(nextProps: LogsContainerProps): boolean {
return (
nextProps.loading !== this.props.loading ||
nextProps.dedupStrategy !== this.props.dedupStrategy ||
nextProps.logsHighlighterExpressions !== this.props.logsHighlighterExpressions
);
}
render() {
const {
exploreId,