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

Ember data 1.13.8 should have removed _registerHelper deprecations warnings but didn't #3635

Closed
adam-knights opened this issue Aug 10, 2015 · 13 comments

Comments

@adam-knights
Copy link
Contributor

This is continueing on the conversationat the end of issue emberjs/ember-inflector#75.

@jcope2013 was of the opinion that something has gone wrong with the build of 1.13.8 on bower.

To summarise - if you compare http://builds.emberjs.com/tags/v1.13.8/ember-data.js which does not give deprecation warnings and https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.8/ember-data.js which does cause deprecation warnings then theres a large difference in the diff in that the cdnjs file has this section (from about line 2322) while the other does not:

var ember$inflector$lib$lib$utils$register$helper$$default = ember$inflector$lib$lib$utils$register$helper$$registerHelper;

function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration1(name, helperFunction) {
  //earlier versions of ember with htmlbars used this
  ember$lib$main$$default.HTMLBars.helpers[name] = helperFunction;
}

function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration2(name, helperFunction) {
  //registerHelper has been made private as _registerHelper
  //this is kept here if anyone is using it
  ember$lib$main$$default.HTMLBars.registerHelper(name, helperFunction);
}

function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3(name, helperFunction) {
  //latest versin of ember uses this
  ember$lib$main$$default.HTMLBars._registerHelper(name, helperFunction);
}
function ember$inflector$lib$lib$utils$register$helper$$registerHelper(name, helperFunction) {
  if (ember$lib$main$$default.HTMLBars) {
    var fn = ember$lib$main$$default.HTMLBars.makeBoundHelper(helperFunction);

    if (ember$lib$main$$default.HTMLBars._registerHelper) {
      if (ember$lib$main$$default.HTMLBars.helpers) {
        ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration1(name, fn);
      } else {
        ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3(name, fn);
      }
    } else if (ember$lib$main$$default.HTMLBars.registerHelper) {
      ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration2(name, fn);
    }
  } else if (ember$lib$main$$default.Handlebars) {
    ember$lib$main$$default.Handlebars.helper(name, helperFunction);
  }
}

/**
 *
 * If you have Ember Inflector (such as if Ember Data is present),
 * singularize a word. For example, turn "oxen" into "ox".
 *
 * Example:
 *
 * {{singularize myProperty}}
 * {{singularize "oxen"}}
 *
 * @for Ember.HTMLBars.helpers
 * @method singularize
 * @param {String|Property} word word to singularize
*/
ember$inflector$lib$lib$utils$register$helper$$default('singularize', function (params) {
  return ember$inflector$lib$lib$system$string$$singularize(params[0]);
});

/**
 *
 * If you have Ember Inflector (such as if Ember Data is present),
 * pluralize a word. For example, turn "ox" into "oxen".
 *
 * Example:
 *
 * {{pluralize count myProperty}}
 * {{pluralize 1 "oxen"}}
 * {{pluralize myProperty}}
 * {{pluralize "ox"}}
 *
 * @for Ember.HTMLBars.helpers
 * @method pluralize
 * @param {Number|Property} [count] count of objects
 * @param {String|Property} word word to pluralize
*/
ember$inflector$lib$lib$utils$register$helper$$default('pluralize', function (params) {
  var count, word;

  if (params.length === 1) {
    word = params[0];
    return ember$inflector$lib$lib$system$string$$pluralize(word);
  } else {
    count = params[0];
    word = params[1];

    if (count !== 1) {
      word = ember$inflector$lib$lib$system$string$$pluralize(word);
    }
    return count + ' ' + word;
  }
});

The cdnjs file matches exactly what I get from bower, and so in ember data 1.13.8 I still get deprecation warnings on _registerHelper and makeBoundHelper

A quick way to repo the issue is to go to http://ember-twiddle.com/, open console and switch twiddle.json on the left between the above two 1.13.8 urls.

@adam-knights
Copy link
Contributor Author

The exact deprecation warnings are:

DEPRECATION: Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to using `Ember.Helper` or `Ember.Helper.helper`. [deprecation id: ember-htmlbars.make-bound-helper]

and

DEPRECATION: Using Ember.HTMLBars._registerHelper is deprecated. Helpers (even dashless ones) are automatically resolved. [deprecation id: ember-htmlbars.register-helper]

DEBUG: Ember                       : 1.13.6
DEBUG: Ember Data                  : 1.13.8

and Ember CLI 1.13.7


DEPRECATION: Using Ember.HTMLBars.makeBoundHelper is deprecated. Please refactor to using Ember.Helper or Ember.Helper.helper. [deprecation id: ember-htmlbars.make-bound-helper]
at Object.makeBoundHelper (http://localhost:4200/assets/vendor.js:21270:32)
at ember$inflector$lib$lib$utils$register$helper$$registerHelper (http://localhost:4200/assets/vendor.js:75716:51)
at http://localhost:4200/assets/vendor.js:75746:5
at http://localhost:4200/assets/vendor.js:90277:4

DEPRECATION: Using Ember.HTMLBars._registerHelper is deprecated. Helpers (even dashless ones) are automatically resolved. [deprecation id: ember-htmlbars.register-helper]
at Object._ret.v as _registerHelper
at ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3 (http://localhost:4200/assets/vendor.js:75712:40)
at ember$inflector$lib$lib$utils$register$helper$$registerHelper (http://localhost:4200/assets/vendor.js:75722:13)
at http://localhost:4200/assets/vendor.js:75746:5
at http://localhost:4200/assets/vendor.js:90277:4

@bmac
Copy link
Member

bmac commented Aug 10, 2015

This was my fault. It looks like I built 1.13.8 with a stale version of ember-inflector in my node_modules. I'll cut a new release today.

@btecu
Copy link
Contributor

btecu commented Aug 11, 2015

Is it going to be a new version or still 1.13.8?

@bmac
Copy link
Member

bmac commented Aug 11, 2015

It will be a new version 1.13.9.

@eibrahim
Copy link

when do you expect 1.13.9 to be out?

@bmac
Copy link
Member

bmac commented Aug 13, 2015

@bmac bmac closed this as completed Aug 13, 2015
@zimmi
Copy link

zimmi commented Aug 14, 2015

Thank you very much for the new release, all the deprecation warnings are gone now. :)

Updating to the new version of ember-inflector sadly broke pluralization though (emberjs/ember-inflector#85). Before that is fixed it might not be wise to update just yet. Just an info for others arriving here from search engines.

@engwan
Copy link

engwan commented Aug 17, 2015

I just upgraded to Ember data 1.13.9 but still have the deprecation messages. Is there anything else I should do?

EDIT: Nevermind, I updated ember data in package.json but not the one in bower.json 😵

@btecu
Copy link
Contributor

btecu commented Aug 17, 2015

@engwan What deprecation message do you get? Try removing the bower and node_modules folders, npm cache clean and bower cache clean then nom install and bower install.

@engwan
Copy link

engwan commented Aug 17, 2015

So I updated bower.json ember-data to 1.13.9 but still get the same errors.. I tried clearing bower_components and node_modules too..

DEPRECATION: Ember.Handlebars.helper is deprecated, please refactor to Ember.Helper.helper [deprecation id: ember-htmlbars.handlebars-helper]
at Object.handlebarsHelper as helper
at http://localhost:4200/assets/vendor.js:72475:22
at http://localhost:4200/assets/vendor.js:72604:4

DEPRECATION: Using Ember.Handlebars.makeBoundHelper is deprecated. Please refactor to using Ember.Helper.helper. [deprecation id: ember-htmlbars.handlebars-make-bound-helper]
at Object.deprecatedMakeBoundHelper as makeBoundHelper
at Object.handlebarsHelper as helper
at http://localhost:4200/assets/vendor.js:72475:22
at http://localhost:4200/assets/vendor.js:72604:4

DEPRECATION: Ember.Handlebars.helper is deprecated, please refactor to Ember.Helper.helper [deprecation id: ember-htmlbars.handlebars-helper]
at Object.handlebarsHelper as helper
at http://localhost:4200/assets/vendor.js:72494:22
at http://localhost:4200/assets/vendor.js:72604:4

DEPRECATION: Using Ember.Handlebars.makeBoundHelper is deprecated. Please refactor to using Ember.Helper.helper. [deprecation id: ember-htmlbars.handlebars-make-bound-helper]
at Object.deprecatedMakeBoundHelper as makeBoundHelper
at Object.handlebarsHelper as helper
at http://localhost:4200/assets/vendor.js:72494:22
at http://localhost:4200/assets/vendor.js:72604:4

ember.debug.js:5442 DEBUG: -------------------------------
ember.debug.js:5442 DEBUG: Ember : 1.13.8
ember.debug.js:5442 DEBUG: Ember Data : 1.13.9
ember.debug.js:5442 DEBUG: jQuery : 1.11.3
ember.debug.js:5442 DEBUG: Ember Simple Auth : 0.8.0-beta.3
ember.debug.js:5442 DEBUG: Ember Simple Auth Testing : 0.8.0-beta.3
ember.debug.js:5442 DEBUG: -------------------------------

Those lines in vendor.js points to the same ember-inflector lines as before.

@eibrahim
Copy link

weird. it worked fine for me. I have:

DEBUG: -------------------------------
ember.debug.js:5442 DEBUG: Ember      : 1.13.8
ember.debug.js:5442 DEBUG: Ember Data : 1.13.9
ember.debug.js:5442 DEBUG: Firebase   : 2.2.9
ember.debug.js:5442 DEBUG: EmberFire  : 1.5.0
ember.debug.js:5442 DEBUG: jQuery     : 1.11.3
ember.debug.js:5442 DEBUG: -------------------------------

@adamsrog
Copy link

This worked for me, thanks.

@engwan did you update your package.json too?

@engwan
Copy link

engwan commented Aug 28, 2015

I got it working already. It was ember-cli-mirage causing the deprecation and not ember-data :)

cdmwebs pushed a commit to bus-detective/web-client that referenced this issue Oct 12, 2015
Fixes more deprecation warnings with Ember.HTMLBars.makeBoundHelper:

emberjs/data#3635
cdmwebs pushed a commit to bus-detective/web-client that referenced this issue Oct 13, 2015
Fixes more deprecation warnings with Ember.HTMLBars.makeBoundHelper:

emberjs/data#3635
cdmwebs pushed a commit to bus-detective/web-client that referenced this issue Oct 13, 2015
Fixes more deprecation warnings with Ember.HTMLBars.makeBoundHelper:

emberjs/data#3635
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

No branches or pull requests

7 participants