2
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 06 Aug 2023
2 points (100.0% liked)
Lemmy App Development
714 readers
1 users here now
A place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform.
On-Topic:
- programming questions related to the Lemmy platform
- sharing your ideas, WIP, or released Lemmy-related work
Off-Topic:
- general programming questions unrelated to Lemmy
- feature requests for developers
- sharing or promoting work not related to Lemmy
founded 1 year ago
MODERATORS
Ah, I wasn’t fully understanding, I see what you’re saying now. There’s no way to know the number of comments on a single level/depth as of now without some extra fetching. I think your best bet at this point would be preloading the next page of comments on the top level, and if no comments are return you then know not to show the “load more” button.
Then, each time the next page of top-level comments is fetched, you can also fetch the children of each comment. This will prevent unwanted layout shift and ensure all children are fetched. If you don’t do this, I’ve noticed sometimes child comments go missing when I try to fetch multiple levels of comments in one request from a larger comment tree (100+ comments)