-
Notifications
You must be signed in to change notification settings - Fork 356
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: fix scroll to latest entry [DET-3673] #936
fix: fix scroll to latest entry [DET-3673] #936
Conversation
@@ -323,7 +327,7 @@ const LogViewer: React.FC<Props> = forwardRef(( | |||
*/ | |||
setTimeout(() => { | |||
if (!container.current) return; | |||
container.current.scrollTo({ top: container.current.scrollHeight }); | |||
container.current.scrollTo({ behavior: 'smooth', top: container.current.scrollHeight }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer a janky instant jump to smooth animation (it's faster too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't reproduce the issue on master reliably to be able to test the same behavior against this branch but this looks reasonable a slight downside being that if you slightly scroll away from the bottom you could still be in tailing mode.
An approach I was thinking of was using an explicit flag to show either we are tailing or not. this flag could be switched by
- user explicitly moves the scroll all the way to the bottom
- user explicitly moves the scroll away from the bottom
- maybe an actual UI toggle
then on every new entry instead of computing scroll position and pixel differences we would just look at the flag. I haven't spent much time on it so it might not be better/feasible/or trivial.
should we retest this after #876 has landed?
94fc055
to
0e84ab2
Compare
I like these ideas. I haven't looked into this yet, but it could be a bit tricky to distinguish between user triggered scrolling and scrolling triggered by tailing or other events. The detection of when to start or end the tailing behavior could end up being some similar logic. Let's leave this for a separate ticket as it seems a bit non-trivial. On thought is that the |
0280080
to
3e59bd1
Compare
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Makes the configuration for o184i054 (Grenoble) a little more like the current setup.
Description
There is a race condition between when new entries are fetched and when the scroll-to-latest button is clicked. What is considered the end or the bottom may differ due to timing. To address this, add a threshold of what is considered to be the "bottom" or the "end" so there is some flexibility so the tailing feature will continue to function even though the scroll-to-latest does not necessary hit the absolute end (threshold provided as the wiggle room).
Test Plan
Commentary (optional)