Skip to content

Commit 2da78cc

Browse files
committed
[Fix]MainThread access warning
1 parent 0480d29 commit 2da78cc

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

DemoApp/Sources/Components/Reactions/ReactionsAdapter.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,18 @@ final class ReactionsAdapter: ObservableObject, @unchecked Sendable {
191191
}
192192

193193
private func unregister(reaction: Reaction, for userId: String) {
194-
var found = false
195-
let userReactions = activeReactions[userId]?.filter { item in
196-
if !found, reaction.id == item.id {
197-
found = true
198-
return false
199-
} else {
200-
return true
194+
Task { @MainActor in
195+
var found = false
196+
let userReactions = activeReactions[userId]?.filter { item in
197+
if !found, reaction.id == item.id {
198+
found = true
199+
return false
200+
} else {
201+
return true
202+
}
201203
}
204+
activeReactions[userId] = userReactions
202205
}
203-
activeReactions[userId] = userReactions
204206
}
205207

206208
private func handleCallEnded() {

0 commit comments

Comments
 (0)