Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs: Fixed 'horizontally scrolling resumes paused streaming' #1149

Merged
merged 1 commit into from
Feb 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/public/components/utils/log-window.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class LogWindow extends React.PureComponent {
content: '',
height: '',
};
this.prevScrollLeft = null;
}

static getDerivedStateFromProps(nextProps) {
Expand Down Expand Up @@ -50,11 +51,19 @@ export class LogWindow extends React.PureComponent {
}

_handleScroll() {
const scrollLeftChanged = this.prevScrollLeft !== this.scrollPane.scrollLeft;

// Stream is finished, take no action on scroll
if (this.props.status === STREAM_EOF) {
return;
}

// If horizontal scrolling, take no action
if (scrollLeftChanged) {
this.prevScrollLeft = this.scrollPane.scrollLeft;
return;
}

// 1px fudge for fractional heights
const scrollTarget = this.scrollPane.scrollHeight - (this.scrollPane.clientHeight + 1);
if (this.scrollPane.scrollTop < scrollTarget) {
Expand All @@ -73,6 +82,7 @@ export class LogWindow extends React.PureComponent {

const targetHeight = Math.floor(window.innerHeight - this.scrollPane.getBoundingClientRect().top -
(this.props.isFullscreen ? FULLSCREEN_FUDGE_FACTOR : FUDGE_FACTOR));
this.prevScrollLeft = this.scrollPane.scrollLeft;
this.setState({
height: targetHeight,
});
Expand Down