-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
fix(glimmer-wrapper): add normalize
method for Registry#has
#300
fix(glimmer-wrapper): add normalize
method for Registry#has
#300
Conversation
226e484
to
00aa96c
Compare
tbh, I think we should still try to land that fix upstream. Doing it in here is really brittle.
|
🙇 |
This seems to be broken. if (true) {
Resolver.prototype.normalize = function (specifier) {
// This method is called by `Registry#validateInjections` in dev mode.
// https://github.com/ember-cli/ember-resolver/issues/299
const [type, name] = specifier.split(':', 2);
if (name && (type === 'service' || type === 'controller')) {
return `${type}:${Ember.String.dasherize(name)}`;
}
return specifier;
};
} I assume that this is because Ember manually collapses the prototype and What is your suggested solution? Use const Resolver = GlobalsResolver.extend({
// ...
normalize: !DEBUG ? null : function(specifier) {
// This method is called by `Registry#validateInjections` in dev mode.
// https://github.com/ember-cli/ember-resolver/issues/299
const [type, name] = specifier.split(':', 2);
if (name && (type === 'service' || type === 'controller')) {
return `${type}:${dasherize(name)}`;
}
return specifier;
},
// ...
}); I assume constant ternaries are also optimized away by |
Just tested the above fix in our app. It works. I'll send another PR. |
Fixes #299.