-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 canary] Fix _lookupFactory deprecation for Ember canary #4743
Conversation
3f10a03
to
df13f60
Compare
if (owner.factoryFor) { | ||
mixin = owner.factoryFor('mixin:' + normalizedModelName) && owner.factoryFor('mixin:' + normalizedModelName).class; | ||
} else { | ||
mixin = owner._lookupFactory('mixin:' + normalizedModelName); |
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.
Should this use ES6 backticks for consistency with the other uses?
if (owner.factoryFor) { | ||
return owner.factoryFor | ||
} | ||
} |
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.
Is this uses?
@@ -43,5 +43,6 @@ function getOwner(context) { | |||
|
|||
export { | |||
modelHasAttributeOrRelationshipNamedType, | |||
getOwner | |||
getOwner, | |||
factoryFor |
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.
this appears to not be a function anymore?
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.
oops, I only removed part of the 💩
@@ -12,11 +12,11 @@ function modelHasAttributeOrRelationshipNamedType(modelClass) { | |||
return get(modelClass, 'attributes').has('type') || get(modelClass, 'relationshipsByName').has('type'); | |||
} | |||
|
|||
/* | |||
/** |
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.
Do you mind removing the extra *
s that were added in this file? YUIDoc sees these as API docs even though these functions are never made available to the user.
let mixin; | ||
|
||
if (owner.factoryFor) { | ||
mixin = owner.factoryFor(`mixin:${normalizedModelName}`) && owner.factoryFor(`mixin:${normalizedModelName}`).class; |
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.
Should this be cached?
5aad35a
to
2833861
Compare
@@ -2107,7 +2114,11 @@ Store = Service.extend({ | |||
let trueModelName = this._classKeyFor(modelName); | |||
let owner = getOwner(this); | |||
|
|||
return owner._lookupFactory(`model:${trueModelName}`); | |||
if (owner.factoryFor) { | |||
return owner.factoryFor(`model:${trueModelName}`) && owner.factoryFor(`model:${trueModelName}`).class; |
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.
This could be cached too
let mixin; | ||
|
||
if (owner.factoryFor) { | ||
mixin = owner.factoryFor(`mixin:${normalizedModelName}`) && owner.factoryFor(`mixin:${normalizedModelName}`).class; |
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.
Seems odd to go through the factoryFor
twice like this, I'd suggest a refactor to:
let MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);
mixin = MaybeMixin && MaybeMixin.class;
@@ -2107,7 +2114,11 @@ Store = Service.extend({ | |||
let trueModelName = this._classKeyFor(modelName); | |||
let owner = getOwner(this); | |||
|
|||
return owner._lookupFactory(`model:${trueModelName}`); | |||
if (owner.factoryFor) { | |||
return owner.factoryFor(`model:${trueModelName}`) && owner.factoryFor(`model:${trueModelName}`).class; |
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.
Same comment as above, we shouldn't call factorFor
twice in a row like this...
2833861
to
c5fe04c
Compare
c5fe04c
to
33859b0
Compare
@@ -2034,7 +2034,13 @@ Store = Service.extend({ | |||
// container = < 1.11 | |||
let owner = getOwner(this); | |||
|
|||
let mixin = owner._lookupFactory('mixin:' + normalizedModelName); | |||
if (owner.factoryFor) { |
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.
Looks like a let mixin;
got lost in the squash.
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.
✅
33859b0
to
7ef8273
Compare
Thanks @locks. |
I was in the process of fixing up ember-data-model-fragments for |
Will do. |
This pr has been pulled into the beta cycle and included in the https://github.com/emberjs/data/releases/tag/v2.12.0-beta.2 release. |
Thank you @bmac! |
I'm happy to report ember-data-model-fragments' test pass on all channels. Thanks!! |
No description provided.