mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-04 23:59:29 +00:00
wrap with trycatch StateFlowBasedRecyclerViewAdapter listener
This commit is contained in:
@@ -15,6 +15,7 @@ abstract class StateFlowBasedRecyclerViewAdapter<T>(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
dataState.onEach {
|
dataState.onEach {
|
||||||
|
try {
|
||||||
val diffForRemoves = Diff(data, it)
|
val diffForRemoves = Diff(data, it)
|
||||||
val removedIndexes = diffForRemoves.removed.map { it.index }
|
val removedIndexes = diffForRemoves.removed.map { it.index }
|
||||||
val leftRemove = removedIndexes.toMutableList()
|
val leftRemove = removedIndexes.toMutableList()
|
||||||
@@ -41,6 +42,9 @@ abstract class StateFlowBasedRecyclerViewAdapter<T>(
|
|||||||
notifyItemInserted(it.index)
|
notifyItemInserted(it.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
// currently do nothing
|
||||||
|
}
|
||||||
}.launchIn(listeningScope)
|
}.launchIn(listeningScope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user