-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non singleton injections are treated as singleton #3310
Comments
by default all lookups return a singleton per container. public api: https://github.com/emberjs/ember.js/blob/master/packages/ember-application/lib/system/application.js#L373-L399 |
Ok |
@taras I'm available on irc #emberjs if you want further clarification. This part of ember does lack guides. |
@stefanpenner I tried to find you on IRC but I don't know your handle. I'm not sure if you looked at my JSBin, but it seems like a very awkward inconsistency to support Here is original http://jsbin.com/aguLeDi/11/edit and another http://jsbin.com/usaluc/12/edit by @intuitivepixel that shows singleton injections working when injected into controllers. Could you please take another look at this? |
reopening, till i have a chance to digest the above request. |
@stefanpenner @taras I've narrowed down a failing test for this: https://github.com/lukemelia/ember.js/compare/injections-fix?expand=1 The issue is in the factory caching in |
@lukemelia thanks for digging into this Ya, commenting that out would mean every instance gets it own factory, which is non-deal. I have a proper solution in mind. Specifically, the work @kselden and I have been discussing would solve this. |
@lukemelia thank you for looking into this. |
@stefanpenner is this fixed? |
@stefanpenner ping. |
not fixed, will be part of the next container related refactor. |
@stefanpenner fixed yet? |
no |
A non-singleton injection should prevent caching of an object or factory instance in a container. [Fixes emberjs#3310]
I'm trying to figure out if I found a bug or I'm just misunderstanding register/inject functionality.
JSBin shows multiple instances of person are created using lookup and I would expect for each person to have a unique instance of App.FavoriteFruit because its injected into person as a non-singleton injection.
The failing test shows that different instances of people are created but they share an instance of favorite fruit.
Is this a bug? ( tests don't cover this scenario )
The text was updated successfully, but these errors were encountered: