Originally created by @zachwaugh on GitHub (Oct 28, 2020).
In general, are properties of the read-only main context objects live updated? Assuming they are fetched initially from the main data stack and only accessed from the main thread with all changes done in transactions. Sorry if this is an obvious question, but I couldn't find a clear answer. Here's a simple example:
classController{// An individual message fetched from the main data stackletmessage=dataStack.fetchOne(From<Message>().where(\.id==1))funcupdate(){dataStack.perform(asynchronous:{transactionin// a property is updated in a transactionletmessage=transaction.edit(self.message)message.title="Test"},completion:{_inself.didUpdate()})}funcdidUpdate(){// This is after the transaction saved// will message.title == "Test"?}}
Originally created by @zachwaugh on GitHub (Oct 28, 2020).
In general, are properties of the read-only main context objects live updated? Assuming they are fetched initially from the main data stack and only accessed from the main thread with all changes done in transactions. Sorry if this is an obvious question, but I couldn't find a clear answer. Here's a simple example:
```swift
class Controller {
// An individual message fetched from the main data stack
let message = dataStack.fetchOne(From<Message>().where(\.id == 1))
func update() {
dataStack.perform(
asynchronous: { transaction in
// a property is updated in a transaction
let message = transaction.edit(self.message)
message.title = "Test"
},
completion: { _ in
self.didUpdate()
}
)
}
func didUpdate() {
// This is after the transaction saved
// will message.title == "Test"?
}
}
```
From a quick test, it appears that the main dataStack properties are updated, but this comment indicates that would only be the case if there was an observer/monitor attached: https://github.com/JohnEstropia/CoreStore/issues/352#issuecomment-562797703. Hoping you can clear that up, thank you!
Objects in the main thread would get updated, eventually. What I meant in the comment you linked is that if you rely on the timing of the updates you should be using one of the Observers/Publishers otherwise you have no control when they get updated
@JohnEstropia commented on GitHub (Oct 29, 2020):
Objects in the main thread would get updated, eventually. What I meant in the comment you linked is that if you rely on the timing of the updates you should be using one of the Observers/Publishers otherwise you have no control when they get updated
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @zachwaugh on GitHub (Oct 28, 2020).
In general, are properties of the read-only main context objects live updated? Assuming they are fetched initially from the main data stack and only accessed from the main thread with all changes done in transactions. Sorry if this is an obvious question, but I couldn't find a clear answer. Here's a simple example:
From a quick test, it appears that the main dataStack properties are updated, but this comment indicates that would only be the case if there was an observer/monitor attached: https://github.com/JohnEstropia/CoreStore/issues/352#issuecomment-562797703. Hoping you can clear that up, thank you!
@JohnEstropia commented on GitHub (Oct 29, 2020):
Objects in the main thread would get updated, eventually. What I meant in the comment you linked is that if you rely on the timing of the updates you should be using one of the Observers/Publishers otherwise you have no control when they get updated
@zachwaugh commented on GitHub (Oct 29, 2020):
Perfect, thank you!