Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,38 @@ internal class InteropUIBlockListener : UIManagerListener {
if (beforeUIBlocks.isEmpty()) {
return
}
beforeUIBlocks.forEach {
if (uiManager is UIBlockViewResolver) {
it.execute(uiManager)
// avoid ConcurrentModificationException by iterating over a copy
try {
val snapshot = ArrayList(beforeUIBlocks)
snapshot.forEach { block ->
if (uiManager is UIBlockViewResolver) {
block.execute(uiManager)
}
}
} catch (e: ConcurrentModificationException) {
// ignore any mid-iteration mutations
} finally {
beforeUIBlocks.clear()
}
beforeUIBlocks.clear()
}

override fun didMountItems(uiManager: UIManager) {
if (afterUIBlocks.isEmpty()) {
return
}
afterUIBlocks.forEach {
if (uiManager is UIBlockViewResolver) {
it.execute(uiManager)
// avoid ConcurrentModificationException by iterating over a copy
try {
val snapshot = ArrayList(afterUIBlocks)
snapshot.forEach { block ->
if (uiManager is UIBlockViewResolver) {
block.execute(uiManager)
}
}
} catch (e: ConcurrentModificationException) {
// ignore any mid-iteration mutations
} finally {
afterUIBlocks.clear()
}
afterUIBlocks.clear()
}

override fun didDispatchMountItems(uiManager: UIManager) = didMountItems(uiManager)
Expand Down