Comments (5)
You're right @ermik that normally you don't need to call DataModelManager.shared
normally, but it's completely legitimate to do so. You may need to do this to handle things like push notifications or a remote update to the model and you don't want to create a data provider to listen on the change.
Here's a few things which may help you debug:
- Do you see isEqualToModel called on your model?
- Do you see
func modelUpdated(_ model: ConsistencyManagerModel?, updates: ModelUpdates, context: Any?)
called in the data provider? Possibly it's returning becausechangeTimeAndContext
is returning out of date? - Put a breakpoint in the ConsistencyManager on line 319.
self.updateListeners
. Here islisteners
empty? Or does it have a value?
I don't know of any changes which should have broken this...we have some tests for this which are still passing, but it's possible that something has changed :/
from rocketdata.
Alright. Thank you for your time and help.
from rocketdata.
I can't speak to the changes in the library code. I hope Peter or another contributor gets a chance to do that.
From my personal experience (meaning I may be wrong) I can tell you that under regular circumstances DataModelManager.shared
singleton is not meant to be accessible by the client code. Only use methods available on a given instance of DataProvider
& CollectionDataProvider
, which, under the hood use the singleton in the convenience initializer. Lastly, remember that the delegate methods are only called when the data is updated somewhere else — meaning you need two data providers in different parts of the app to see RocketData in action.
from rocketdata.
Thank you for the response. I have managed to debug the suggested code. These are my results:
I am using the default implementation of isEqualToModel
, because my model is Equatable. It looks like the problem was that only the ID
of my model was used to decide if a model is equal with an other one. This made isEqualToModel
to return true even if the value of one of the properties changed.
I think this was the reason why func modelUpdated(_ model: ConsistencyManagerModel?, updates: ModelUpdates, context: Any?)
was not called at all.
I did not see any problems with the third bullet point. The listeners
is not empty.
Luckily including the favourited
property in the Equatable
implementation solves the problem on my side. However I am not sure why it was working correctly with an older version of the library.
What do you think?
from rocketdata.
Yeah, I don't know why the old version was working...this is expected behavior. It shouldn't call the delegate method if the model has not changed.
Thanks for doing the debugging on your end. Let me know if you have any other questions on the library.
Closing because it looks like this issue is fixed.
from rocketdata.
Related Issues (20)
- CollectionDataProvider.fetchDataFromCache can fail to set the cacheKey HOT 7
- Wrong version of ConsistencyManager installed when installing via cocoapods HOT 2
- Can u maintain an objective-c version? HOT 3
- How to purge all items in the DataProvide and empty the cache in one shot? HOT 1
- Using model objects in Objective-C HOT 3
- Can this lib be used in conjunction with Realm? HOT 2
- Can you provide a way to completely clean data HOT 3
- One-to-many relationship: retrieve child object from cache HOT 3
- Example App with complex models HOT 1
- Why does siblingProvidersForProvider not return current provider? HOT 1
- Handling cutdown API objects HOT 2
- Setting CollectionDataProvider cacheKey without setting data
- ConsistencyManager 5.1 and Cocoapods HOT 6
- Crash: DataProvider.swift line 92 DataProvider.init(dataModelManager : DataModelManager) -> DataProvider<A> HOT 10
- dataProviderHasUpdatedData is not called when passing a new different model to the DataProvider HOT 2
- fetchDataFromCache(withCacheKey:listenToModelIdentifier... methods unavailable HOT 8
- Notifying CollectionDataProvider of updates in a child model HOT 9
- Add SwiftUI support
- Catalyst compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocketdata.