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
--- 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;
}