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
This commit is contained in:
nchevobbe
2017-04-12 17:21:27 +02:00
parent e3ca23cf09
commit 72f4acabef

View File

@@ -39,7 +39,11 @@ const ConsoleOutput = createClass({
},
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);
},