Don
26 Noviembre, 2021 08:57
1
Hello,
With the latest update 1b5f26e0ab I used all day and the problem appear yesterday night. So I think the issue in one of the last few commits.
It seems to happens when I touch and start scrolling. The scrolling is not start immediately.
The issue seems to only on Android on both view (mobile and desktop) and the PWA and browser too.
It affect on the whole site where scrolling available.
My device:
Android 10
Chrome 96.0.4664.45
Thanks
3 Me gusta
david
(David Taylor)
26 Noviembre, 2021 12:55
2
This is very interesting, thanks for reporting! As far as I’m aware, the only recent commit which affects scrolling would be:
committed 12:07PM - 25 Nov 21 UTC
- Remove JQuery
- Remove legacy `document.webkitHidden` support. None of our cu… rrently supported browsers need this
- Use `passive` event listeners. These allows the browser to process the events first, before passing control to us
- Add a new `unseenTime` parameter. This allows consumers to request a delay before being notified about the browser going into the background
- Add a method for removing a callback
- Fire the callback when presence changes in either direction. Previously it would only fire when the user becomes present after a period of inactivity.
- Ensure callbacks are only called once for each state change. Previously they would be called every 60s, regardless of the value
- Listen to the `visibilitychanged` and `focus` events, treating them as equivalent to user action. This will make messagebus re-activate more quickly when switching back to a stale tab
- Add test helpers
- Delete the unused `discourse/lib/page-visible` module.
- Call message-bus's onVisibilityChange API directly, rather than dispatching a fake event on the `document`
But if anything, I would have expected that to make scrolling smoother , not worse! (I switched this particular feature to use ‘passive’ event listeners, rather than blocking event listeners)
Do you have the same problem on try.discourse.org ?
As an experiment, I just made a theme here on Meta which removes those updated event listeners. https://meta.discourse.org/?preview_theme_id=260 (Named “Experiment - remove scroll listener” in the hamburger) Does this theme fix the lagging for you?
3 Me gusta
Don
26 Noviembre, 2021 13:04
3
Hi David,
Thank you for the quick response. Unfortunately there is the same issue on try and the Experiment - remove scroll listener theme too.
2 Me gusta
david
(David Taylor)
26 Noviembre, 2021 13:05
4
Thanks for checking! In a way I’m glad that didn’t fix it, because I have no idea why that change would cause worse performance!
I’ll do another comb through recent commits and see if I can spot anything suspicious
Would you mind letting us know the make/model of your device, so I can try to reproduce in a simulator?
2 Me gusta
Don
26 Noviembre, 2021 13:10
5
On second thought, yes, it is positive
Sure my device is a Huawei P20 Pro
2 Me gusta
Falco
(Falco)
26 Noviembre, 2021 13:30
6
Cant repro this on my phone on either Chrome or Firefox.
4 Me gusta
Osama
26 Noviembre, 2021 16:03
7
I can repro here on Meta using my Pixel 4 XL running Android 12. I didn’t notice it until I read this topic. The best way to see it is to scroll short distances (~2cm on the screen) repeatedly.
3 Me gusta
david
(David Taylor)
26 Noviembre, 2021 16:34
8
I made this improvement:
committed 03:25PM - 26 Nov 21 UTC
Calling `setProperty("--header-offset", newValue)` will always cause a 'Recalcul… ate Style' event, even if the value is unchanged. On my browser, these 'Recalculate Style' events take about 6-7ms each time the `dockCheck` function is run.
This commit stores the 'previous' value in an instance variable, and only calls setProperty if the value has changed. This brings the total runtime of `dockCheck` down to about 70µs on my machine.
Which is now deployed to meta. Does that feel any better @Don ?
That issue isn’t new though, so I’m not sure why it only started being noticeable in the last couple of days
6 Me gusta
Don
26 Noviembre, 2021 16:37
9
David now it is perfect Thank you!
I saw yesterday a commit about software update prompt Maybe that is related with this issue?
5 Me gusta
david
(David Taylor)
26 Noviembre, 2021 16:41
10
Glad to hear it!
Oh yes, you’re absolutely right! I totally missed that. This commit from yesterday refactored the --header-offset
logic so that it runs all the time, rather than ‘only when docked’. That slowed down scroll performance. My fix made that logic more efficient, so that’s why it’s working now.
8 Me gusta