Giter VIP home page Giter VIP logo

Comments (10)

EisenbergEffect avatar EisenbergEffect commented on June 2, 2024

I'll check this out myself.

from dependency-injection.

EisenbergEffect avatar EisenbergEffect commented on June 2, 2024

Confirmed that placing singleton() on a view model works as expected, at least in the master.

from dependency-injection.

jods4 avatar jods4 commented on June 2, 2024

Do you have an example?

Placing @singleton() or @singleton(false)? because a few releases ago it was @singleton(false).

Any idea what could influence this? Because it definitely does not work in my code base on current release and I'm 100% sure it previously did.

from dependency-injection.

jods4 avatar jods4 commented on June 2, 2024

I am pretty sure it does not work -- or I don't understand how it's intended to work.

I have done some debugging and it seems the breaking change is here:
5e2b75b#diff-dcf9a6cedb6d0d9a360cc92ddaa1c0c2L52

Before commit #5e2b75b, the singleton createResolver used to return a root singleton when registerInChild was false and such a singleton already existed.
After the change, a new resolver is always created and returned. It is then registered at root (kinda) but that doesn't really matter... since the already existing singleton resolver at root is not returned, a new instance has to be created.

I think that's why my view are recreated every time.

from dependency-injection.

alvarezmario avatar alvarezmario commented on June 2, 2024

@jods4 Today will probably by a pre-beta release, perhaps is solved here

from dependency-injection.

jods4 avatar jods4 commented on June 2, 2024

Maybe, but doubtful as the sources I was looking at are master and they don't seem fundamentally different from what I'm running.

If there's a pre-beta release coming, I think this should be double-checked ASAP before the release because it's a major bug, that's worthy of being fixed for that release.

from dependency-injection.

EisenbergEffect avatar EisenbergEffect commented on June 2, 2024

There was a bug in the DI in the last released. It has been fixed. I tested this myself by simply placing @singleton() on the welcome view model in the navigation-skeleton app.

from dependency-injection.

jods4 avatar jods4 commented on June 2, 2024

Can you refer the fixing commit? I need to patch this today.

from dependency-injection.

EisenbergEffect avatar EisenbergEffect commented on June 2, 2024

ca5ccf7#diff-dcf9a6cedb6d0d9a360cc92ddaa1c0c2R94

Getting the latest master will require the latest of metadata also...but that is going to break everything else. So, just wait for a little bit. We are going to try to get a pre-beta release out today.

from dependency-injection.

jods4 avatar jods4 commented on June 2, 2024

I managed to patch around this bug but I had to do it a very ugly way. When I tried to apply the changes you linked above, the result was still the same (i.e. not reusing the same VM for the whole app). But maybe that was because I was missing other relevant bits.

I'll test with the new release and report if it doesn't work.

from dependency-injection.

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.