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 history did not stick to bottom on visibility changes #2320

Merged
merged 3 commits into from
Dec 30, 2024

Conversation

mofojed
Copy link
Member

@mofojed mofojed commented Dec 27, 2024

fix: Console history did not stick to bottom on visibility changes

  • When debugging, I found that the Code block was rendering while the Console tab was in the background (invisible, size 0) so when it did finally render, there was a lot of content added but it wasn't scrolled. By checking sticky bottom when visibility changes, we handle this situtation where content causes a resize while it is invisible
  • Use an IntersectionObserver to detect visibility changes: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
  • Tested by running the following:
  1. Run a code snippet to print a bunch of lines, causing the console history to scroll:
for i in range(0, 200):
    print("i is", i)
  1. Run a snippet to create a dashboard, and have a lot of text in the command:
from deephaven import ui

... have lots of blank lines so that it takes up more than a page of scroll space

d = ui.dashboard(ui.panel("Hello"))
  1. Go back to the Console tab, see that it is still scroll to the bottom.

- When debugging, I found that the `Code` block was rendering while the Console tab was in the background (invisible, size 0) so when it did finally render, there was a lot of content added but it wasn't scrolled. By checking sticky bottom when visibility changes, we handle this situtation where content causes a resize while it is invisible
- Use an IntersectionObserver to detect visibility changes: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
- Tested by running the following:
1. Run a code snippet to print a bunch of lines, causing the console history to scroll:
```python
for i in range(0, 200):
    print("i is", i)
```
2. Run a snippet to create a dashboard, and have a lot of text in the command:
```python
from deephaven import ui

... have lots of blank lines so that it takes up more than a page of scroll space

d = ui.dashboard(ui.panel("Hello"))
```
3. Go back to the Console tab, see that it is still scroll to the bottom.
@mofojed mofojed requested a review from vbabich December 27, 2024 17:14
@mofojed mofojed self-assigned this Dec 27, 2024
- Needed to define `IntersectionObserver` on the `window`
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

Attention: Patch coverage is 35.71429% with 9 lines in your changes missing coverage. Please review.

Project coverage is 46.70%. Comparing base (57b6e21) to head (e121c90).

Files with missing lines Patch % Lines
packages/console/src/Console.tsx 35.71% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2320      +/-   ##
==========================================
- Coverage   46.71%   46.70%   -0.01%     
==========================================
  Files         704      704              
  Lines       39013    39026      +13     
  Branches     9747     9750       +3     
==========================================
+ Hits        18224    18229       +5     
- Misses      20778    20786       +8     
  Partials       11       11              
Flag Coverage Δ
unit 46.70% <35.71%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mofojed mofojed merged commit 648e8c0 into deephaven:main Dec 30, 2024
11 checks passed
@mofojed mofojed deleted the fix-console-scroll-dashboard branch December 30, 2024 14:20
@github-actions github-actions bot locked and limited conversation to collaborators Dec 30, 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