Open creesch opened 4 years ago
Additional thought, it probably also needs to unload content when it is out of the viewport.
Another complication here is how scrolling will work, ideally we'd have a good idea what the height of a rendered comment will be and make the placeholder the same height.
Edit:
It might be just enough to set visibility to none for elements outside of the viewport. More testing there is needed.
Oooor we could start by not doing a shitload of jsapi events... https://github.com/toolbox-team/reddit-moderator-toolbox/blob/master/extension/data/modules/comment.js#L439-L445
Currently when flatview is used on a large thread it tends to slow things down a lot. This is mainly due to all those comments being rendered and shown in the browser. We probably can do something much smarter here with
viewportObserver
by only rendering the comments first that will be visible and then on scroll render what is needed. Similar to how we handle the toolbox jsAPI implementation on old redditI am fairly sure there is even a term for that I am currently unable to think about.
I am currently thinking that we do create placeholder divs for each possible comment but only build and place it once it becomes part of the viewport.
Some things that we need to consider