MozReview: Specify ordering filediffs by id (Bug 1248008) r?smacleod draft
authorPiotr Zalewa <pzalewa@mozilla.com>
Fri, 06 Jan 2017 10:36:17 +0100
changeset 253 08f493196e8c29c20d4e08b51a8373091077bb06
parent 252 76c79cacb8d440a0cb8a76c7978edb029c745a36
child 256 adddbcafa9dda5a6fe6bbf3d588296e7cfc97c2d
child 270 98c105ed468da05e8df4252cbdc45672c72ca388
push idunknown
push userunknown
push dateunknown
reviewerssmacleod
bugs1248008
MozReview: Specify ordering filediffs by id (Bug 1248008) r?smacleod Backbone's set function performs a merge of the existing models, rather than fully replacing them (New items are added, missing items are removed, and existing items are merged). It appears this merge operation does not preserve the order of the models which are passed into set (instead the existing items end up before the others). Setting the comparator to id tells the set function to sort by that attribute. MozReview-Commit-ID: Buz561YZlf8
reviewboard/reviewboard/static/rb/js/diffviewer/collections/diffFileCollection_mozreview.js
--- a/reviewboard/reviewboard/static/rb/js/diffviewer/collections/diffFileCollection_mozreview.js
+++ b/reviewboard/reviewboard/static/rb/js/diffviewer/collections/diffFileCollection_mozreview.js
@@ -1,6 +1,7 @@
 /*
  * A collection of files.
  */
 RB.DiffFileCollection = Backbone.Collection.extend({
-    model: RB.DiffFile
+    model: RB.DiffFile,
+    comparator: 'id'
 });