msfjarvis / compose-lobsters

Claw for Android: Unofficial read-only client for https://lobste.rs, built using Jetpack Compose.
https://play.google.com/store/apps/details?id=dev.msfjarvis.claw.android
MIT License
102 stars 8 forks source link

Comments don't remember their collapsed state #651

Closed msfjarvis closed 2 months ago

msfjarvis commented 2 months ago

Since the fix for #584 landed we no longer retain the collapsed state of individual comments which eliminates the jumpiness during rendering by always rendering expanded comments. It might be useful to find a way of remembering collapsed comments without reintroducing that problem.

rubenquadros commented 2 months ago

Hey there! Can you provide a bit more context? This is my first time coming across this app! The users should be able to expand/collapse a comment? And when scrolling this state should be retained? Okay I installed the apk.. So you do not retain the collapsed/expanded state when the user scrolls and you would want to do so but without introducing any jank/jumpiness?

msfjarvis commented 2 months ago

Pretty much, yeah. You can probably try to implement this via hoisting a list of expanded/collapsed comment IDs at the screen level but if I remember correctly it introduces jumpiness into the scrolling because of the layout size changing on the fly.

rubenquadros commented 2 months ago

Hmmm let me give it a try!

rubenquadros commented 2 months ago

Quick question - why is CommentNode a class? Can it be a data class? I have made some changes and it seems to work for me. I can raise a MR and we can discuss on that.

msfjarvis commented 2 months ago

Quick question - why is CommentNode a class? Can it be a data class? I have made some changes and it seems to work for me. I can raise a MR and we can discuss on that.

It can be a data class, there are no API stability considerations here. Feel free to raise the PR, I'm around for the next couple hours to review.

rubenquadros commented 2 months ago

There is an unwanted side-effect because of the implementation. You can checkout the draft MR and also the commit message and we can brainstorm on how to solve it. https://github.com/msfjarvis/compose-lobsters/pull/673