Using Observations with SwiftData @Model

I want to use the Observations AsyncSequence on some SwiftData @Model instances to determine if internal calculations need to be done.

When a simple property is linked to the Observations it fires CONTINUOUSLY even though no change is made to the model property.

Also, when I try to observe a property which is a list of another @Model type the Observations sequence does not fire when I add or remove items.

I am hoping to use the async-algorithm's merge function so all the associated sequences can be combined since if any of the associated events should fire the calculation event.

Would you mind to provide a minimal project to demo the issue? I'd be interested in taking a look. Your post can contain a link to where your project is hosted.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

The demo of course is not repeating the problem - I am going to sift through the stacktrace to see when these values are being set because arrrg

https://github.com/chenrichsen/SwiftDataObservations

I am working on the "real" project. The changes to the list of @Model are still not being captured in the Observations. When I modify or add/remove from the list sometimes a property of the object that IS NOT changed shows as being changed. That property has exactly one setter call and is not linked to the edit, add, or remove code.

When I tried to observe the list as a whole, I "achieved" a FATAL ERROR for illegal attempt to resolve a future for a relationship that doesn't have a cached value!

Ziqiao (et al), if you can provide any ideas greatly will appreciated

Using Observations with SwiftData @Model
 
 
Q