Scrolling function has issues (Scroll Jank) - was fixed, happening again?

This is getting annoying. So I’ll try to help fix (or work around) it.

First important thing for any debugging is duplication. I think I found a way to 100% duplicate. Can anyone please check if you can duplicate scroll jank this way as well, step by step? (@Marco @slawa …)

Note: I’m using Chrome Windows in incognito mode, simply in order to be not logged in. That means I can simply re-start as a “new user” again and again, just by copy & paste an address into the address bar.

Here we go:

  1. Open a new tab. Copy and paste this into the address bar, press ENTER: https://tw.forumosa.com/t/ukraine-invaded-by-the-russians-again/214479/ (= go to a long thread, for example post #1 of the Ukraine war thread)

  2. Click the Forumosa logo on top (= go back to the Forumosa main page)

  3. Click on the Ukraine war thread (= go back to the thread. Discourse “remembered” where you left off and shows post #2, with a red line “last visit” shown above)

  4. Now scroll down. Scroll jank will happen when you reach around post # 17. It will throw you back up to post #3

What I understand so far:

  • The issue doesn’t seem to happen if you haven’t visited a certain thread before, eg. if there is no “last visit” marker

  • Also happens with shorter threads, like 40 posts… I guess everything above ~17 posts might be affected

  • Also happens with old threads, like this one which has the last reply in 2007

  • Does NOT happen if you disable showing images (!). interesting… I’ll look further into this, maybe it can point us to which images (loaded from where) are involved in this issue…

Further details hidden as not to annoy people that just want to help duplicate, not help debug
  • The scroll jank seems to happens when you reach the end of the already loaded posts, when presumably Discourse starts loading the next batch of posts to show next

  • You can see this by looking at the Chrome scroll bar: The scroll jank happens when the scroll bar reaches almost the end

  • Activating the developer tools (CTRL + Shift + i) and looking at the “console”, there are no errors or warnings during that time when the jank happens. There is one “Violation” though, which is visible only when adding “verbose” to the filter levels. Violations seem to to be nothing critical, it seems to be more something like “you might want to look this for Performance optimization”.

  • The violation says “[Violation] ‘setTimeout’ handler took 56ms”. I only see this in the bad case. But it is also visible when disabling images - then the violation appears, but there is NO scroll jank. So I guess this is not related to the root cause.

I recorded what happens, and this is the order in which it happens. Not very useful I’m afraid:

  1. The view jumps back to the older post. At the same time the scroll bar jumps up showing that more posts have been loaded, and the “[Violation] ‘setTimeout’ handler took 56ms” appears

  2. After a very short delay the post counter updates from 17 to 3, where we just jumped to

5 Likes