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

--HG--
extra : rebase_source : 7be84aeadd33e5c57131b35da2dea5e7bc3611b0
This commit is contained in:
nchevobbe 2017-04-12 17:21:27 +02:00
Родитель 7500121261
Коммит 8f16cb5be3
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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);
},