From 93d49d73e5d4fa2f38f2822f0ff0178189472b55 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 20 Jan 2013 04:06:44 +0100 Subject: Keep track of resets in table view so we don't keep rendering stale rows. --- frontend/js/views/SongTable.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/js/views/SongTable.js b/frontend/js/views/SongTable.js index 9554de4..0250dd5 100644 --- a/frontend/js/views/SongTable.js +++ b/frontend/js/views/SongTable.js @@ -43,8 +43,11 @@ var SongTable = Backbone.View.extend({ }, appendSong: function(song) { var that = this; + var ref = this.viewRef; _.defer(function() { var row; + if (ref !== that.viewRef) + return; if (!(song.id in that.songRows)) row = that.songRows[song.id] = new SongRow({ model: song }); that.$tbody.append(row.render().el); @@ -53,6 +56,7 @@ var SongTable = Backbone.View.extend({ render: function() { this.$tbody.empty().scrollTop(0); this.songRows = {}; + this.viewRef = new Object(); this.collection.each(this.appendSong); this.showHideLoadall(); return this; -- cgit v1.2.3-59-g8ed1b