Giter Site home page Giter Site logo

Comments (5)

plivesey avatar plivesey commented on June 30, 2024 2

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:

  1. Do you see isEqualToModel called on your model?
  2. Do you see func modelUpdated(_ model: ConsistencyManagerModel?, updates: ModelUpdates, context: Any?) called in the data provider? Possibly it's returning because changeTimeAndContext is returning out of date?
  3. Put a breakpoint in the ConsistencyManager on line 319. self.updateListeners. Here is listeners 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.

TankoSz avatar TankoSz commented on June 30, 2024 1

Alright. Thank you for your time and help.

from rocketdata.

ermik avatar ermik commented on June 30, 2024

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.

TankoSz avatar TankoSz commented on June 30, 2024

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.

plivesey avatar plivesey commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.