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

fix: Console does not scroll to bottom when code run from notebook #2114

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

mattrunyon
Copy link
Collaborator

Noticed running code from a notebook wasn't scrolling to the bottom.

I didn't catch this behavior changing in #2076, but looks like the componentDidUpdate doesn't necessarily wait until after the paint or the ref isn't updated for some reason. So the scrollHeight can be the old value and then scrollTo (or scrollTop = scrollHeight) triggers the scroll event which sets isStuckToBottom to false. Not exactly sure

The requestAnimationFrame call seems to be working. The other option I thought of what ignoring programmatic scrolling, but the only way I saw to do that was to set some state in the class and then check it in the scroll handler and reset it after. There's nothing about the event that indicates if it was triggered via scrollTo.

There were some weird update values when I was logging this. Like the height would be 1900 for 3 renders, then 1700, then 1900 again. Guessing it's due to rendering of the console buttons.

@mattrunyon mattrunyon self-assigned this Jun 27, 2024
Copy link
Contributor

@AkshatJawne AkshatJawne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, it is weird that the requestAnimationFrame is it making it work though. I believe I had this in my code originally, then I think based on a review, I had changed it.

Nonetheless, I remember it not making a difference in the behaviour, but maybe I had not observed closely enough.

@mattrunyon
Copy link
Collaborator Author

Could even be OS dependent. I just noticed it when I was running chunks of code from a notebook that created tables

@mattrunyon mattrunyon merged commit e75e716 into deephaven:main Jun 27, 2024
10 checks passed
@mattrunyon mattrunyon deleted the console-scroll-fix branch June 27, 2024 20:18
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants