I'm having an issue where FetchRequest does not consistently reflect changes that are made in the CoreData model. Things seem to work fine if you create or delete any object before editing, but if you only edit an object, the changes will not be shown.
Here is a minimal repro: https://github.com/literalpie/fetchrequest-bug/tree/main
I have a workaround that involved adding a "noop" predicate that gets toggled whenever objectWillChange
is emitted. This seems to force the FetchRequest to re-look at things.
.onReceive(items.publisher.flatMap(\.objectWillChange), perform: { _ in
items.nsPredicate = update ? NSPredicate(value: true) : NSPredicate(format: "1 == 1")
update.toggle()
})