Преглед изворни кода

[search] Do not add dynamic fields more than once

Romain Rigaux пре 11 година
родитељ
комит
5a611dc
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      apps/search/static/js/search.ko.js

+ 3 - 1
apps/search/static/js/search.ko.js

@@ -233,7 +233,9 @@ var Collection = function (vm, collection) {
     },function (data) {
       if (data.status == 0) {
         $.each(data.dynamic_fields, function (index, field) {
-          self.fields.push(field);
+          if (self.fields.indexOf(field) == -1) {
+            self.fields.push(field);
+          }
         });
       }
     }).fail(function (xhr, textStatus, errorThrown) {