소스 검색

Performance fix. Don't loop through whole roster when only one item changed. updates #151

JC Brand 10 년 전
부모
커밋
b2b4474439
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      converse.js

+ 2 - 1
converse.js

@@ -3493,7 +3493,8 @@
             rosterHandler: function (items, item) {
                 converse.emit('roster', items);
                 this.clearCache(items);
-                _.each(items, function (item, index, items) {
+                var new_items = item ? [item] : items;
+                _.each(new_items, function (item, index, items) {
                     if (this.isSelf(item.jid)) { return; }
                     var model = this.get(item.jid);
                     if (!model) {