MozReview: Specify ordering filediffs by id (Bug 1248008) r=smacleod
authorPiotr Zalewa <>
Fri, 06 Jan 2017 10:36:17 +0100
changeset 69 75a7c1033075182ebd1a8ea0de5078053ce505e4
parent 68 6a7fac88d5b0569607e57598e9077f5e6f12895d
child 70 dfbc927623b7aa5a99b6a90681f762d4b43e8e66
push id39
push dateThu, 16 Feb 2017 15:15:51 +0000
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
--- 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'