Bug 1355869 - Delay scrollToBottom on next tick in console init. r=bgrins draft
authornchevobbe <nchevobbe@mozilla.com>
Wed, 12 Apr 2017 17:21:27 +0200
changeset 561963 7be84aeadd33e5c57131b35da2dea5e7bc3611b0
parent 561885 1f1c921f172cfb6f299e9ed810b748de6bede180
child 624132 deb60b2467f21ef76ada4caef9e28bee753c187b
push id53914
push userbmo:nchevobbe@mozilla.com
push dateThu, 13 Apr 2017 09:27:50 +0000
reviewersbgrins
bugs1355869
milestone55.0a1
Bug 1355869 - Delay scrollToBottom on next tick in console init. r=bgrins The call to scrollToBottom could take a good amount of time if there were already logged messages in the console. This might be related to the fact that componentDidMount is called although there is some layout or paint work. Delaying the first call to scrollToBottom in the component greatly reduced the time spent in scrollToBottom. MozReview-Commit-ID: F3cRYV4OFhm
devtools/client/webconsole/new-console-output/components/console-output.js
--- a/devtools/client/webconsole/new-console-output/components/console-output.js
+++ b/devtools/client/webconsole/new-console-output/components/console-output.js
@@ -34,17 +34,21 @@ const ConsoleOutput = createClass({
     autoscroll: PropTypes.bool.isRequired,
     dispatch: PropTypes.func.isRequired,
     timestampsVisible: PropTypes.bool,
     groups: PropTypes.object.isRequired,
     messagesTableData: PropTypes.object.isRequired,
   },
 
   componentDidMount() {
-    scrollToBottom(this.outputNode);
+    // Do the scrolling in the nextTick since this could hit console startup performances.
+    // See https://bugzilla.mozilla.org/show_bug.cgi?id=1355869
+    setTimeout(() => {
+      scrollToBottom(this.outputNode);
+    }, 0);
     this.props.serviceContainer.attachRefToHud("outputScroller", this.outputNode);
   },
 
   componentWillUpdate(nextProps, nextState) {
     if (!this.outputNode) {
       return;
     }