Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Backbone Todo Views are zombies #259

anodynos opened this Issue · 3 comments

2 participants


To reproduce it, simply amend the render() of the todo view to something like :

// Re-render the titles of the todo item.
render : function (aModel) {
    // log todoView rendering 
    console.log("todoView.render:" + (aModel ? aModel.get("id") : ""));

Then click on the filters (active / completed) a few times, to cause a re-population of todo views.
Then check the complete state of a todo item, and you will see render() being called multiple times for that same model. All those calls are on zombie views, as discussed here and here

The problem is in addOne that simply recreates a new todoView

var todoView = new TodoView({model : todo});

without having any logic to remove / reuse previously created views for that model.
Consequently the zombie views are still in memory, listeing to change events, rerendering them selves etc.

This I think is a very bad example setting, especially for newbies in JS/backbone. It stems from the problematic way Backbone deals with views, but a good practices example like todomvc should have a complete approach on how to deal with important issues.


@anodynos Would you be interested in putting together a pull request that demonstrates how you would avoid this issue? I'm not entirely convinced there are Zombies here, but I'm happy to discuss it with some of the Backbone contributors to make sure it's following bad practices once we have a reference to go on.


Sure, my honor! I 'll try to devise a non-intrusive simplistic solution that either reuses a view or creates on after having properly disposed a view and its bindings.


This was fixed. Closing.

@addyosmani addyosmani closed this
@gustaff-weldon gustaff-weldon referenced this issue from a commit in gustaff-weldon/todomvc
@addyosmani addyosmani Add changes for #259, started in #260 2239797
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.