mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Use a Task instead of a DispatchQueue to fix the flakey observation tests. (#4321)
When debugging in, sometimes the value hadn't been set after dispatching, whereas it has with a Task. Not sure I fully understand why and it's annoying that there aren't any observation APIs for didSet.
This commit is contained in:
@@ -20,8 +20,8 @@ extension Observable {
|
||||
let value = withObservationTracking {
|
||||
self[keyPath: property]
|
||||
} onChange: {
|
||||
// Dispatch the update as this is willSet not didSet.
|
||||
DispatchQueue.main.async {
|
||||
// Handle the update on the next run loop as this is willSet not didSet.
|
||||
Task {
|
||||
guard isActive else { return }
|
||||
observe()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user