You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have objects which are related together like this:
final class RItem: Object {
@Persisted(indexed: true) var key: String
@Persisted(originProperty: "item") var tags: LinkingObjects<RTypedTag>
}
final class RTag: Object {
@Persisted(indexed: true) var name: String
@Persisted(originProperty: "tag") var tags: LinkingObjects<RTypedTag>
}
final class RTypedTag: Object {
enum Kind: Int, PersistableEnum {
case automatic = 1
case manual = 0
}
@Persisted var type: Kind
@Persisted var tag: RTag?
@Persisted var item: RItem?
}
Then I have a screen with a simple tableView which shows items, but also includes some information about tags for each item. I observe Results<RItem> and reload tableView when I receive an update:
results.observe(keyPaths: ["tags"]) { [weak self] change in
switch change {
case .error: return
case .initial(let results):
self?.reload(with: results.freeze())
case .update(let results, _, _, _):
self?.reload(with: results.freeze())
}
}
private func reload(with snapshot: Results<RItem>) {
self.snapshot = snapshot
self.tableView.reloadData()
}
When a new RTypedTag is created and assigned to an item, the table view updates correctly. But when an RTypedTag is deleted from database, I receive no update for this change, so tableView keeps showing old state. I also tried changing the keyPaths to "tags.tag" or "tags.tag.name", but they both resulted in the same behaviour.
I'm attaching a simplified sample project, where I reproduced this issue.
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
See included simple project. Try to "add" and then "remove" a tag and see that tableView changes when tag is added, but it doesn't change after deletion is performed.
Version
10.23.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 15
Build environment
Xcode 13.2, SwiftPM
The text was updated successfully, but these errors were encountered:
How frequently does the bug occur?
All the time
Description
I have objects which are related together like this:
Then I have a screen with a simple
tableView
which shows items, but also includes some information about tags for each item. I observeResults<RItem>
and reloadtableView
when I receive an update:When a new
RTypedTag
is created and assigned to an item, the table view updates correctly. But when anRTypedTag
is deleted from database, I receive no update for this change, sotableView
keeps showing old state. I also tried changing thekeyPaths
to"tags.tag"
or"tags.tag.name"
, but they both resulted in the same behaviour.I'm attaching a simplified sample project, where I reproduced this issue.
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
See included simple project. Try to "add" and then "remove" a tag and see that
tableView
changes when tag is added, but it doesn't change after deletion is performed.Version
10.23.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 15
Build environment
Xcode 13.2, SwiftPM
The text was updated successfully, but these errors were encountered: