Giter Club home page Giter Club logo

Comments (5)

arturovt avatar arturovt commented on May 26, 2024

What for? :)

When your tab is reloaded - all memory gets released, there is no need to unsubscribe.

from until-destroy.

NetanelBasal avatar NetanelBasal commented on May 26, 2024

I think he meant hmr.

from until-destroy.

NetanelBasal avatar NetanelBasal commented on May 26, 2024

Note that you're adding extra code (untilDestroyed) to support development mode with hmr.

from until-destroy.

Rush avatar Rush commented on May 26, 2024

Let's say you're working on an app that uses firebase. It's likely you have singleton services that create some subscriptions - and every such subscription holds an active websocket. With HMR the tab does not reload and new instances of the angular app and new instances of services get created. This leads to gradual slowdown and leakage of resources ... I know because I had this problem until I found untilDestroyed. It is extra code in non-HMR environment but in my opinion it's totally worth it.

Also, such singleton services made with untilDestroyed can easily be converted to component level services.

Additionally singleton services get destroyed in unit tests all the time ...

I think handling proper lifecycle in singleton services is simply a good idea - that's why I got confused by the README. Hopefully the use case is still supported with Ivy.

from until-destroy.

NetanelBasal avatar NetanelBasal commented on May 26, 2024

I think we can remove this message and leave the decision to the developer. In general, @arturovt is right, but as you said, there are edge cases such as hmr.

from until-destroy.

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.