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] Replace private and deprecated _lookupFactory with public & performant factoryFor #442

Conversation

cibernox
Copy link
Contributor

No API surface has changed. _factoryFor will be removed in 2.13.

@offirgolan
Copy link
Collaborator

@cibernox thank you for this. Can you move the code to a util file? Something like:

// addon/utils/lookup-class.js
export default function lookupClass(owner, type) {
  let klass;
  if (owner.factoryFor) {
        let maybeKlass = owner.factoryFor(type);
        klass = maybeErrorMessages && maybeErrorMessages.class;
      } else {
        klass = owner._lookupFactory(type);
      }
return klass;
}

@cibernox
Copy link
Contributor Author

sure

@offirgolan
Copy link
Collaborator

@cibernox thanks! Also, is there a need to fallback to _lookupFactory? Shouldnt the getOwner polyfill take care of that?

@cibernox
Copy link
Contributor Author

@offirgolan It is needed. getOwner gives you an applicationInstance, but ApplicationInstance#factoryFor was added in 2.12.

@cibernox cibernox force-pushed the use-factory-for-fixes-deprecations branch from 6a99cb8 to bd8317d Compare January 24, 2017 19:53
@cibernox
Copy link
Contributor Author

@offirgolan I added it in -private, because it's for internal usage only.

@offirgolan offirgolan changed the title Replace private and deprecated _lookupFactory with public & performant factoryFor [BUGFIX] Replace private and deprecated _lookupFactory with public & performant factoryFor Jan 24, 2017
@offirgolan offirgolan merged commit d52dc02 into adopted-ember-addons:master Jan 24, 2017
@offirgolan
Copy link
Collaborator

@cibernox released with v3.2.2. Thanks again for the help 😸

@cibernox cibernox deleted the use-factory-for-fixes-deprecations branch January 25, 2017 23:34
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.

2 participants