mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-12 04:10:36 +01:00
Change local data doesn't updated when fetchingOne object from core store #297
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pajtimid on GitHub (Dec 6, 2019).
I'm changing local data and they aren't updating. I have to kill app and after opening again they are updated.
I'm using async callbacks and after completion needs to be updated.
the last func doesnt getting updated local datas.
P.S. In SquelLite browser shows changed data
@JohnEstropia commented on GitHub (Dec 7, 2019):
If there aren't any
ListMonitors,ObjectMonitors, orObjectPublishers attached to this object it will never be updated on its own. My suggestion here is to useObjectPublisheras it is the most lightweight. (See https://github.com/JohnEstropia/CoreStore#observe-a-single-objects-updates )Once any of the monitor/publisher types are attached to that object, you don't need to call anything else to keep that object updated. (Observation will allow you to react to those changes though)
@pajtimid commented on GitHub (Dec 9, 2019):
I'm not understanding clearly the way that I should implement this ObjectPublisher. Can you help me on this, where to put publisher?
@AlwaysBee commented on GitHub (Dec 15, 2019):
Please make sure that the "dataStack" is the SAME one, otherwise your update would not works in different dataStack, unless you relaunch the app
@JohnEstropia commented on GitHub (Dec 16, 2019):
Ah yes, there is this too
@JohnEstropia commented on GitHub (Dec 16, 2019):
@pajtimid As @AlwaysBee mentioned, it's possible you are using a default-initialized stack. This is a much more common mistake so please check first that:
DataStackyou created and assigned toself.dataStackis not getting accessed anywhere else before youraddStorage(...)executes itscompletionblock.DataStackyou are callingperform(asynchronous:completion:)on is still the same instance as (1)DataStackyou are callingfetchOne(_:)on is still the same instance as (1) and (2)@pajtimid commented on GitHub (Dec 20, 2019):
I solved it. My problem was on: one-to-many relationship.
My
locationsvariable isSet<Locations>typeI removed this line
newData.locations.insert(newDataLocation)and updated well.
I don't know why this is happening!