瀏覽代碼

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
kay delaney 6 年之前
父節點
當前提交
57dadebbd8
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      public/app/features/explore/LogsContainer.tsx

+ 10 - 0
public/app/features/explore/LogsContainer.tsx

@@ -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,