You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, any change to State<T> causes the reconstruction that removes all views and readds it to view.
Solution
I propose next variant with wrapping view adding feature and comparing views ids on each reconstruction:
remember(ids =1, ...) {
// this state is used for updating data of recyclerview that was created before// data update.val items =State<List<Account>>(emptyList())
state.constructOnEach { state ->if(state isFooVM.State.Failure) {
...
} else {
// we set data to update old recycler view or for new, if it's first construction with recycler
items.value = state.accounts
recyclerView(id =1, adapter =FooAdapter(), data = items)
}
}
}
*It requires custom realization of recycler view that has items (data) as state value
For this kind of realization, we should have custom StatedViewGroup to be able to compare new and old trees.
The text was updated successfully, but these errors were encountered:
Problem
Currently, any change to
State<T>
causes the reconstruction that removes all views and readds it to view.Solution
I propose next variant with wrapping view adding feature and comparing views ids on each reconstruction:
*It requires custom realization of recycler view that has items (data) as state value
For this kind of realization, we should have custom
StatedViewGroup
to be able to compare new and old trees.The text was updated successfully, but these errors were encountered: