-
-
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
[BUGFIX beta] Make container always return the same value even if the registered value is falsy #12797
Conversation
… registered value is falsy
4c3ab86
to
46257f1
Compare
Looks good to me. @dgeb / @stefanpenner - r? |
@@ -849,12 +849,14 @@ function resolve(registry, normalizedName, options) { | |||
resolved = registry.resolver.resolve(normalizedName); | |||
} | |||
|
|||
resolved = resolved || registry.registrations[normalizedName]; | |||
if (resolved === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this expression the opposite of what we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't understand what is the problem. I think this change is necessary for the following case:
QUnit.test('The value returned from resolver is the same value as the original value even if the value is falsy', function() {
let resolver = {
resolve(fullName) {
if (fullName === 'falsy:value') {
return null;
}
}
};
let registry = new Registry({ resolver });
deepEqual(registry.resolve('falsy:value'), null);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the above test.
Looks good to me as well. Thanks @hibariya 👍 |
👍 |
[BUGFIX beta] Make container always return the same value even if the registered value is falsy
This fixes #12796.