October 4, 2016 EmberJS
October 4, 2016 EmberJS
Obviously there are general upgrade guides provided by Ember team and many fellow bloggers. This is just to document one of the experiences with upgrading from ember 1.7.0 to 1.13.13.
At the moment of this writing Ember latest stable version is 2.8. My team was one of the early adopters of Ember. I believe the team started incorporating it in late 2013, which is very soon after the 1.0 release. We went live with the version 1.7 at the beginning of 2015 and since that time we didn’t do any updates for “penny wise and pound foolish” reasons.
Upgrade itself was a bit of pain as it spread for couple of months. We allocated few days per sprint and at the same time continued developing new features the old way in other branches. Bad idea.
Another pain was that we adopted Ember Data while it was still beta. As a result we have custom code altering adapter’s and serializer’s behaviour. There are many breaking changes between beta versions of Ember Data, so using it while in beta was a very bad idea.
One of great things about being on Ember 1.13.13 version is that you are effectively on 2.0.0 version unless you have deprecation messages in your console. This also means that you can still release your application with some parts not being completely converted to the new way of doing things. ember.prod.js
doesn’t generate warnings and works just fine. I really like the way Ember tries to make upgrading easy. Here is a nice write up on handling deprecations as of 2.3.0.
This list is composed from notes I took so it is not very well organized and does not contain all of the items we had to fix.
“Ember Data cannot read property 'async' of undefined"
pushObject
with addRecord
to fix “You looked up the relationship on a with id but some of the associated records were not loaded.”
Ember.Handlebars.helpers.render.call(this, name, contextString, options)
Ember.set()
whenever there was controller.isNew
property with some setHTMLBars
instead of Handlebars
by incorporating ember-template-compiler
template = template.replace(/\uFEFF/g, ''); // remove BOM
{async: false}
MetamorphView
. Fixes this: Assertion Failed: A fragment cannot be pushed into a buffer that contains content because of: view.createChildView(Ember._MetamorphView, {
At this point you start to get tons of deprecation messages.
`someProperty` from `<App.SomeXyzController:ember2661>`, but object proxying is deprecated. Please use `model.someProperty` instead
.{{action bubbles=false preventDefault=false}}
to this {{action "ok" "close" "cancel" bubbles=false preventDefault=false}}
Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`
. Ember.HTMLBars.compile(submitHtmlTemplate);
doesn’t produce a correct function to retrieve HTML. Can be solved as in this SO answer.@each
at the end of a computed key is deprecated and will not work in Ember 2.0Ember.Enumerable.mapProperty
with mapBy
Ember.Handlebars.helper
with Ember.Helper.helper
itemController
I hope this comes in handy for you.
code
more code
~~~~