diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-01-20 04:06:44 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-01-20 04:06:44 +0100 |
commit | 93d49d73e5d4fa2f38f2822f0ff0178189472b55 (patch) | |
tree | 6f3d239af6e56e79bcd7932ebe78b7ea0e551de6 | |
parent | Work around safari positioning. (diff) | |
download | zmusic-ng-93d49d73e5d4fa2f38f2822f0ff0178189472b55.tar.xz zmusic-ng-93d49d73e5d4fa2f38f2822f0ff0178189472b55.zip |
Keep track of resets in table view so we don't keep rendering stale rows.
-rw-r--r-- | frontend/js/views/SongTable.js | 4 |
1 files changed, 4 insertions, 0 deletions
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; |