Skip to content
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

Merged
merged 1 commit into from
Jan 12, 2017

Conversation

locks
Copy link
Contributor

@locks locks commented Jan 10, 2017

No description provided.

@locks locks force-pushed the factory-for-deprecation branch from 3f10a03 to df13f60 Compare January 10, 2017 17:52
@locks locks changed the title [WIP] Fix _lookupFactory deprecation for Ember canary Fix _lookupFactory deprecation for Ember canary Jan 10, 2017
@locks locks changed the title Fix _lookupFactory deprecation for Ember canary [BUGFIX canary] Fix _lookupFactory deprecation for Ember canary Jan 10, 2017
if (owner.factoryFor) {
mixin = owner.factoryFor('mixin:' + normalizedModelName) && owner.factoryFor('mixin:' + normalizedModelName).class;
} else {
mixin = owner._lookupFactory('mixin:' + normalizedModelName);
Copy link
Member

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
}
}
Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

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');
}

/*
/**
Copy link
Member

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.

@pangratz pangratz assigned pangratz and unassigned pangratz Jan 12, 2017
let mixin;

if (owner.factoryFor) {
mixin = owner.factoryFor(`mixin:${normalizedModelName}`) && owner.factoryFor(`mixin:${normalizedModelName}`).class;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be cached?

@locks locks force-pushed the factory-for-deprecation branch from 5aad35a to 2833861 Compare January 12, 2017 15:38
@@ -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;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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...

@locks locks force-pushed the factory-for-deprecation branch from 2833861 to c5fe04c Compare January 12, 2017 15:46
@locks locks force-pushed the factory-for-deprecation branch from c5fe04c to 33859b0 Compare January 12, 2017 15:47
@@ -2034,7 +2034,13 @@ Store = Service.extend({
// container = < 1.11
let owner = getOwner(this);

let mixin = owner._lookupFactory('mixin:' + normalizedModelName);
if (owner.factoryFor) {
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@locks locks force-pushed the factory-for-deprecation branch from 33859b0 to 7ef8273 Compare January 12, 2017 16:25
@bmac bmac merged commit 2f10ee9 into master Jan 12, 2017
@bmac bmac deleted the factory-for-deprecation branch January 12, 2017 16:52
@bmac
Copy link
Member

bmac commented Jan 12, 2017

Thanks @locks.

@workmanw
Copy link

I was in the process of fixing up ember-data-model-fragments for ember-data-2.12.0-beta. I noticed that the beta channel for ember-data is missing this commit. I'm definitely in no hurry, I just wanted to call out that it's labeled [BUGFIX canary] but needs to be in the beta channel.

@rwjblue
Copy link
Member

rwjblue commented Jan 25, 2017

Ahh, good catch @workmanw. It was likely still canary when the PR was proposed, but once we branched beta for 2.12 the commit prefix didn't get updated.

@bmac - Can this be pulled in for 2.12 beta cycle?

@bmac
Copy link
Member

bmac commented Jan 26, 2017

Will do.

@bmac
Copy link
Member

bmac commented Jan 30, 2017

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.

@rwjblue
Copy link
Member

rwjblue commented Jan 30, 2017

Thank you @bmac!

@workmanw
Copy link

I'm happy to report ember-data-model-fragments' test pass on all channels. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants