Skip to content

Commit d92f10c

Browse files
committed
SwiftOCAUI: fix tab-between-fields requiring double tab
Defer state updates in commitEdit() to the next run loop iteration so that SwiftUI completes the focus transfer before re-rendering.
1 parent cde301a commit d92f10c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/SwiftOCAUI/Views/PropertyView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ public struct OcaWritableTextPropertyView: View {
200200

201201
private func commitEdit() {
202202
guard let editingValue else { return }
203-
currentValue = .success(editingValue)
204203
let value = editingValue
205-
self.editingValue = nil
206-
Task {
204+
Task { @MainActor in
205+
currentValue = .success(value)
206+
self.editingValue = nil
207207
try? await property._setValue(object, value)
208208
}
209209
}

0 commit comments

Comments
 (0)