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

Scroll to Bottom breaks on some timelines; blog lists; activity #1491

Open
marcustyphoon opened this issue Jun 10, 2024 · 2 comments · May be fixed by #1493 or #1492
Open

Scroll to Bottom breaks on some timelines; blog lists; activity #1491

marcustyphoon opened this issue Jun 10, 2024 · 2 comments · May be fixed by #1493 or #1492
Assignees
Labels
bug Something isn't working

Comments

@marcustyphoon
Copy link
Collaborator

Platform

MacOS 14.4.1 arm64

Browser

Chrome 125.0.6422.77

Addon version

dev branch

Details

const loaderSelector = `
${keyToCss('timeline', 'blogRows')} > :last-child,
${keyToCss('notifications')} + ${keyToCss('loader')}
`;

Scroll to Bottom stops after the first jump on all V2 timelines. I believe it is due to the :last-child here not matching the div containing the loader element any more, as the last child of the V2 timeline is an empty div (a react-intersection-observer inView, if the google results for _unobserveCb are to be believed).

@marcustyphoon marcustyphoon added the bug Something isn't working label Jun 10, 2024
@marcustyphoon marcustyphoon changed the title Scroll to Bottom breaks in V2 timelines Scroll to Bottom breaks in V2 timelines; blog lists; activity Jun 11, 2024
@marcustyphoon
Copy link
Collaborator Author

Nope, it's not just that. The loader is not shown all the time and removed when there is nothing else to load any more; rather, it is only added when the endless scrolling element is actively loading, and this state does not appear to be applied synchronously. We're probably going to have to wait an arbitrary time for it to appear, I guess.

@marcustyphoon
Copy link
Collaborator Author

After a bit of poking, it doesn't seem like it's a good idea to try to use some understanding of the timing and order of when certain things happen in the scroll process to precisely target when the loader should be checked for. I could probably figure out what's occurring on each frame of this process, but something like "wait n requestAnimationFrames" isn't that robust, and more importantly, it seems like our resize observer can be triggered multiple times during this process due to the whole mess about how cell repositioning and resizing works on a delay, so it would be meaningless anyway.

(image is for flavor)

Thinking about a technique that doesn't really care about event order at all... maybe one could, like:

  • in the resize observer, set a timer that stops scrolling after n milliseconds (if there are no loaders at that time)
  • register a pageModifications callback for loaders being added to the page. in the callback, if currently scrolling, kill the timer.
  • in stopScrolling, kill the timer
  • also, in the resize observer itself, kill the (previous) timer

So the scroll gets cancelled if we scroll, and in the next n milliseconds, no scroll occurs, no loader gets added and no loader exists. The scroll doesn't get cancelled if there is still a loader (timeline v1) or if a loader gets added or removed, or if a — yeah.

Pretty sure there are no race conditions in that.

@marcustyphoon marcustyphoon self-assigned this Jun 12, 2024
@marcustyphoon marcustyphoon changed the title Scroll to Bottom breaks in V2 timelines; blog lists; activity Scroll to Bottom breaks on some timelines; blog lists; activity Jun 27, 2024
@marcustyphoon marcustyphoon pinned this issue Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant