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.
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 thescrollHeight
can be the old value and thenscrollTo
(orscrollTop = scrollHeight
) triggers thescroll
event which setsisStuckToBottom
to false. Not exactly sureThe
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 viascrollTo
.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.