ember-firebase
ember-firebase copied to clipboard
lists cause unnecessary rerenders
Still debugging this, but I have this code:
var Firebase = require('ember-firebase');
var base = "https://pollster.firebaseio.com";
module.exports = Firebase.Hash.extend({
countRef: function() {
return new Firebase(this.get('ref').toString()+'/count');
}.property(),
incrementCount: function() {
this.get('countRef').transaction(function(currentValue) {
return currentValue + 1;
});
}
});
{{#each choice in choices}}
...
{{/each}}
Every time I call increment count on a choice the whole list gets redrawn. This is particularly problematic when I I'm trying to store these views to make some comparisons. Think of a multiple choice quiz component, you want to store the currently selected answer component, but every interaction with firebase causes everything to redrew so you can't keep state.
Sorry, I know this isn't actionable right now, but I will try to narrow it down some more later.
@rpflorence Just wanted you to know that I have my eye on this issue as well. I haven't had time to debug it quite yet, but it's on my TODO list. I'm experiencing the same issue in my app, so it's mutually beneficial to get it resolved.
@rpflorence Is it necessary for countRef to be a computed property? It seems like it's static, but it will get called every time you access incrementCount and create a new Firebase reference. Could that be the cause of the problem?