Ember.run.once not working with computed property and aggregate data with @each


#1

Hi there,

I will explain this in a simple way, I have a computed property which relies on all items in an array, for example:

totalCost: function () {
        ...
}.property('model.categories.@each.cost')

Then I have a method which just do a simple log, and I want to call this method when something happens to the totalCost property, like:

showTotalCost: function() {
	Ember.run.once(this, 'logCost');
}.observes('totalQuoteCost'),

logCost: function() {
	console.log('helloThere');
}

But the Ember.run.once function is not working, the logCost function will be fired multiple times.

Anyone can help me with this problem? Thanks a lot.


#2

Ember.run.once will only fire the function provided per run-loop.