mjackson / mjackson/ember-firebase

lists cause unnecessary rerenders

Open
#1 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
32
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the redraw with the {{#each choice in choices}} template and the incrementCount Firebase transaction shown in the issue. Trace which Firebase update causes the list to redraw and determine whether unrelated choice views lose their state. Done means the cause is identified and the list no longer redraws unnecessarily when incrementing a choice.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, handlebars, javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.