From 57dadebbd8228ac451ea5c0bfb948ce891c9c131 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Thu, 20 Jun 2019 12:56:47 +0100 Subject: [PATCH] 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 --- public/app/features/explore/LogsContainer.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/app/features/explore/LogsContainer.tsx b/public/app/features/explore/LogsContainer.tsx index 79846e1d4bc..c6ba84aceb0 100644 --- a/public/app/features/explore/LogsContainer.tsx +++ b/public/app/features/explore/LogsContainer.tsx @@ -91,6 +91,16 @@ export class LogsContainer extends PureComponent { 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,