in hot-reload-devtools/src/main/kotlin/org/jetbrains/compose/devtools/states/NotificationsUIState.kt [91:107]
suspend fun collectUIErrors() {
val notifiedErrors = mutableMapOf<WindowId, Pair<UIErrorDescription, UINotification>>()
ErrorUIState.collect { errors ->
for ((windowId, error) in errors.errors) {
if (windowId !in notifiedErrors) {
val notification = error.toNotification()
notifiedErrors[windowId] = error to notification
NotificationsUIState.update { it + notification }
}
}
for (windowId in notifiedErrors.keys - errors.errors.keys) {
notifiedErrors.remove(windowId)?.second?.dispose()
}
}
}