Open MV-GH opened 4 months ago
This is what I have been working on for the past few weeks. Still nowhere near complete but I have managed to prevent the feed from constantly recomposing. (Pinned the topbar solely for easier showcasing as its enter behaviour triggers more recompositions, which it probably shouldn't but no clue on solving that yet)
https://github.com/LemmyNet/jerboa/assets/67873169/051866d4-6a74-4a20-8fb1-1bede56c9eee
It now only updates the item that has changed. But even further might be possible, as its currently fully recomposing that item and the upvote only changes one thing that is the score. So everything else that doesn't change should stay the same. But this is probably the same as the feed due to its immutable nature. olditem ~= newItem and we pass this PostView pretty much into each composable. Thus each composable its arguments are different and recomposes.
I have achieved recomposition count that I find satisfactory for Posts Feed. But I'll leave this open until all the main feeds have been refactored, (Posts/Comments/Inbox/Profile)
Jerboa Version
0.0.60
Description
I did some more research into recompositions in Jerboa.
Before:
Notice how every frame the upvote/downvote/ other actions buttons recompose But the comment counts don't? Well thats how everything supposed to be in a post
https://github.com/dessalines/jerboa/assets/67873169/fb916e8b-b3be-43f9-bb82-cb87040e9ebf
I added 1 remember for upvote action
after:
The upvote doesn't recompose anymore, and only changes when its state changes (pressing upvote) pressing an action also doesn't recompose the other upvotes
https://github.com/dessalines/jerboa/assets/67873169/c49efea2-58be-443c-8b86-5b8a42355074
Exact change in postlisting.kt:
Conclusion:
We need to add way more remembers for every top action passed down.
@dessalines