I have been recently getting the following error seemingly randomly, when an event handler of a SwiftUI view accesses a relationship of a SwiftData model the view holds a reference to. I haven't yet found a reliable way of reproducing it:
SwiftData/BackingData.swift:866: Fatal error: This model instance was invalidated
because its backing data could no longer be found the store.
PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: COREDATA_ID_URL),
implementation: SwiftData.PersistentIdentifierImplementation)
What could cause this error? Could you suggest me a workaround?