Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reduce recompositions in the comments#1979

Merged
dessalines merged 2 commits into
LemmyNet:mainfrom
MV-GH:comments-recompositions
Oct 3, 2025
Merged

Reduce recompositions in the comments#1979
dessalines merged 2 commits into
LemmyNet:mainfrom
MV-GH:comments-recompositions

Conversation

@MV-GH

@MV-GH MV-GH commented Oct 2, 2025

Copy link
Copy Markdown
Collaborator

Well I have reduced the recompositions in the comments, it no longer recomposes while it scrolls.

Cause was the topbar, the padding constantly changes, by moving the body into a separate composable I create a new "root" composable, This composable skips recompositions due to its params never changing. Before it everytime it would recreate everything below when the padding changed. It would recreate the commentsTreeList, the lambda, ... bc of that those comments all had changed params. and thus the whole tree down recomposed.

As you can see from the video when you do any action though, it fully recomposes the entire comments. To achieve only the vote itself recomposing, it would need to refactored to use something similar like we did for the postfeed. But thats too much work for now. Cuz currently it creates a new list each time an actions happens upon the comments. Thus they arent equal anymore.

Sadly this did not end up fixing #1711

So there is still something else going on that makes those images pop in and pop out constantly.

before (whole tree recomposes on every scroll)

eROqbNoO0l.mp4

after (only the pulldownrefresh recomposes because padding changes, and mainbody skips every recompose)

studio64_KtNoOoh3X8.mp4

@MV-GH MV-GH requested a review from dessalines as a code owner October 2, 2025 23:33

@dessalines dessalines left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a weird hidden behavior.... Its probably a good practice then to always create new composables whenever padding is used.

@dessalines dessalines merged commit 7e1acd7 into LemmyNet:main Oct 3, 2025
1 check passed
@MV-GH MV-GH deleted the comments-recompositions branch October 3, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants