We’ve been using payloads and diffs in our recycle...
# coroutines
s
We’ve been using payloads and diffs in our recycler views to react to state changes for a long time now. One idea that came to mind was exposing a flow of state + lifecycle scope to our recycler view’s adapters and collecting the state (from each viewholder) and updating the viewholders’ UI that way. One benefit i see to this is our code complexity drastically reduces while also having a good UX (no flickering/glitches). Does anyone have thoughts on this, pros or cons to considering such an approach?
o
I think you should fix the glitching and flickering
s
The glitching and flickering is handled though the payloads and diffs (DiffUtil) so we don’t really have any issues with that, i was just wondering if the flow approach would be an alternative
j
I think glitches can occur in animations if the model updates the whole list and every property of every view holder. I think an approach of sending a list with ids (in sealed types) and having every view holder observe the state for its id and adjust the view should be good. The only thing what might be challenging is connecting to the correct lifecycle (because your views recycle in the mean time as well)
1
s
Yes exactly! The lifecycle is one of the points i was hoping to get input about.