Skip to content

Commit 2c59bc4

Browse files
committed
Fix that toasting was not happening in MainActor
1 parent 0e8e4c9 commit 2c59bc4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Core/Sources/HostApp/TabContainer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ class ToastController: ObservableObject {
202202
func toast(content: Text, type: ToastType) {
203203
let id = UUID()
204204
let message = Message(id: id, type: type, content: content)
205-
withAnimation(.easeInOut(duration: 0.2)) {
206-
messages.append(message)
207-
}
208205

209206
Task { @MainActor in
207+
withAnimation(.easeInOut(duration: 0.2)) {
208+
messages.append(message)
209+
}
210210
try await Task.sleep(nanoseconds: 4_000_000_000)
211211
withAnimation(.easeInOut(duration: 0.2)) {
212212
messages.removeAll { $0.id == id }

0 commit comments

Comments
 (0)