{ "id": "117420", "key": "ALOY-753", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15402", "description": "Alloy 1.2.0, concurrent with SDK 3.1.0", "name": "Alloy 1.2.0", "archived": false, "released": true, "releaseDate": "2013-08-15" }, { "id": "15571", "description": "2013 Sprint 15", "name": "2013 Sprint 15", "archived": true, "released": true, "releaseDate": "2013-07-29" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-07-22T16:31:52.000+0000", "created": "2013-07-20T06:52:55.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "qe-testadded" ], "versions": [], "issuelinks": [], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-07-31T00:45:14.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13605", "name": "Models" } ], "description": "When collection fetch, \"reset\" event fired twice.\r\n\r\nuser.js\r\n{code:javascript|user.js} \r\nexports.definition = {\r\n\tconfig: {\r\n\t\tadapter: {\r\n\t\t\ttype: \"properties\",\r\n\t\t\tcollection_name: \"user\"\r\n\t\t}\r\n\t},\t\t\r\n\textendModel: function(Model) {\t\t\r\n\t\t_.extend(Model.prototype, {\r\n\t\t\t// extended functions and properties go here\r\n\t\t});\r\n\t\t\r\n\t\treturn Model;\r\n\t},\r\n\textendCollection: function(Collection) {\t\t\r\n\t\t_.extend(Collection.prototype, {\r\n\t\t\t// extended functions and properties go here\r\n\t\t});\r\n\t\t\r\n\t\treturn Collection;\r\n\t}\r\n}\r\n{code} \r\n\r\nindex.js\r\n{code:javascript|title=index.js} \r\nvar personCol = Alloy.createCollection('user');\r\n\r\npersonCol.on('reset',function(){\r\n\talert('reset');\r\n});\r\n\r\npersonCol.fetch();\r\n{code} \r\n\r\nWhy properties adapter call reset method in Sync function (19line properties.js)?\r\n\r\n{code:javascript}\r\nfunction Sync(method, model, opts) {\r\n var prefix = model.config.adapter.collection_name ? model.config.adapter.collection_name : \"default\";\r\n var regex = new RegExp(\"^(\" + prefix + \")\\\\-(.+)$\");\r\n var resp = null;\r\n if (\"read\" === method) if (opts.parse) {\r\n var list = [];\r\n _.each(TAP.listProperties(), function(prop) {\r\n var match = prop.match(regex);\r\n null !== match && list.push(TAP.getObject(prop));\r\n });\r\n model.reset(list); //