Skip to content

Commit d6fc5d4

Browse files
committed
Bug 1966005 - [devtools] Make sure to try auto-scroll after the completion of the sourcemap service r=devtools-reviewers,nchevobbe
Issue: After the sourcemap service has completed it should trigger and update which would cause `maybeScrollToBottomMessageCallback` ( which handles the auto scrolling) to fire. But the `shouldScrollBottom` was failing, as it does not considrer the delayed updates which happen after the sourcemap service is done. Differential Revision: https://phabricator.services.mozilla.com/D249904
1 parent b96015a commit d6fc5d4

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

devtools/client/webconsole/components/Output/ConsoleOutput.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,25 @@ class ConsoleOutput extends Component {
193193

194194
// We need to scroll to the bottom if:
195195
this.shouldScrollBottom =
196-
// - we are reacting to "initialize" action, and we are already scrolled to the bottom
196+
// 1) This is reacting to "initialize" action
197+
// 2) And it has scrolled to the bottom
197198
(!this.props.initialized &&
198199
nextProps.initialized &&
199200
this.scrolledToBottom) ||
200-
// - the number of messages in the store changed and the new message is an evaluation
201-
// result.
201+
// 1) The number of messages in the store has changed
202+
// 2) And the new message is an evaluation result.
202203
isNewMessageEvaluationResult ||
203-
// - the number of messages displayed changed and we are already scrolled to the
204-
// bottom, but not if we are reacting to a group opening.
205-
(this.scrolledToBottom && visibleMessagesDelta > 0 && !isOpeningGroup());
204+
// 1) It is scrolled to the bottom
205+
// 2) And the number of messages displayed changed or it is reacting to a network update but there's no new messages being displayed
206+
// 3) And if it is not reacting to a group opening.
207+
(this.scrolledToBottom &&
208+
(visibleMessagesDelta > 0 ||
209+
(visibleMessagesDelta === 0 &&
210+
// Note: The network updates are throttled and therefore might come in later
211+
// so make sure a scroll to bottom is trggered.
212+
this.props.networkMessagesUpdate !==
213+
nextProps.networkMessagesUpdate)) &&
214+
!isOpeningGroup());
206215
}
207216

208217
componentDidUpdate(prevProps) {

0 commit comments

Comments
 (0)