Coder Social home page Coder Social logo

Comments (8)

chris-feldman avatar chris-feldman commented on August 15, 2024 1

from sunflower.

tiembo avatar tiembo commented on August 15, 2024 1

Hi @sagar-viradiya - yes, please open a new issue and we can discuss the livedata changes there.

from sunflower.

tiembo avatar tiembo commented on August 15, 2024

Thanks for the detailed write-up! Would you be interested in opening a pull request to update the two list ViewModels?

from sunflower.

tiembo avatar tiembo commented on August 15, 2024

Thanks! Note there's a pending fix in #30 that may conflict with your changes.

from sunflower.

sagar-viradiya avatar sagar-viradiya commented on August 15, 2024

I think better solution is to use new fragment life cycle while observing live data.

Read this

https://medium.com/@BladeCoder/architecture-components-pitfalls-part-1-9300dd969808

check note at the end of post

We need to update support lib as new view life cycle is there in 28.0.0

See https://youtu.be/pErTyQpA390?t=5m41s to better understand the issue

from sunflower.

chris-feldman avatar chris-feldman commented on August 15, 2024

from sunflower.

sagar-viradiya avatar sagar-viradiya commented on August 15, 2024

Yeah sorry my bad. Thing is every time you switch fragment from GardenPlantListing to PlantListing and vice versa onCreateView will get call and method in view model also. Which will end up in querying database multiple times. Your PR will fix this issue.

However there is one issue of multiple observation on livedata. So each time you switch fragment new live data observer is being registered. This will lead to multiple callbacks for livedata observer and because of this multiple notifyDataSetChanged() in adapter.

I have figured out this issue. @tiembo Should I create new issue for this ?

from sunflower.

tiembo avatar tiembo commented on August 15, 2024

Closing issue; fixed via #33

from sunflower.

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.