File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
Sources/LiveViewNative/Property Wrappers Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121- ` liveview-native-core ` has been updated to v0.4.0, and is now used for all internal networking
2222
2323### Fixed
24+ - Views will now update properly when the server changes the value of a form field (#1483 )
2425
2526## [ 0.3.1] 2024-10-02
2627
Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ private class FormStateData<Value: FormValue>: ObservableObject {
276276 // When the element updates from the server, sync the new value into the form.
277277 elementCancellable = element. projectedValue
278278 . receive ( on: DispatchQueue . main)
279- . sink { [ weak formModel] _ in
279+ . sink { [ weak formModel, weak self ] _ in
280280 // ignore server updates if the field is focused.
281281 guard !isFocused. wrappedValue && !isEditing. wrappedValue else { return }
282282 formModel? . setServerValue (
@@ -285,6 +285,7 @@ private class FormStateData<Value: FormValue>: ObservableObject {
285285 ?? defaultValue,
286286 forName: elementName
287287 )
288+ self ? . objectWillChange. send ( )
288289 }
289290
290291 // Remove all focus from form fields when the form is submitted.
You can’t perform that action at this time.
0 commit comments