Deovandski
Deovandski

Reputation: 790

Refactoring Computed Properties on Ember.js 1.13

I was able to upgrade most of my Ember.js project to 1.13 after having some issues along the way, but now I can't wrap my head around the following deprecated code:

filteredPosts: function(){...}.property('var1','var2','var3')

When I enable it, the only notice that I receive is:

Uncaught TypeError: controllerClass.proto is not a function.

Noting that ComputedPropertyPrototype.get is the only useful information coming from the Stack Trace.

After researching around, I only found this concerning the deprecation, so I wanted to know how such code would be refactored into the native array methods or into anything that allows the same behavior.

Also, my apologies as I unfortunately cannot post an extra link to the specific file due to being a new user, so if you want to see the complete project you can head to github.com/Deovandski/Fakktion.

Upvotes: 0

Views: 645

Answers (1)

Daniel
Daniel

Reputation: 18672

filteredPosts: function(){...}.property('var1','var2','var3')

should become:

filteredPosts: Ember.computed('var1', 'var2', 'var3', function() {
...
});

It's because prototype extensions are discouraged in recent versions of Ember and seems like you've encountered a problem related to prototype extensions. It'd be best if you create a demo of this issue, but Ember.computed should just work.

Upvotes: 2

Related Questions