I have the following code to listen to an ObjectBox query:
query.publisher
.mapError(DatabaseError.other(nested:))
.eraseToAnyPublisher()
.map(mapEntities(_:))
.catch(handleError) // Returns Empty<[..], Never> but also tried Just<[...]>
.receive(on: DispatchQueue.main)
.sink { results in
self.allEntities = results
})
- I have the
eraseToAnyPublisher
part because up until that part the code is in on other function I removed for simplicity - I save the returned cancellable
After the first values are received, I can see logs from object box that say Unsubscribe
. I've checked the source code and it seems like this happens when the subscriber returns demand .none
but I can't figure out why this happens