{ "id": "129857", "key": "ALOY-1000", "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": "15909", "description": "Alloy 1.5.0", "name": "Alloy 1.5.0", "archived": false, "released": true, "releaseDate": "2014-09-29" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-05-28T16:06:53.000+0000", "created": "2014-05-01T03:02:10.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-manualtest" ], "versions": [], "issuelinks": [], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2014-08-22T23:27:48.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": [], "description": "I have a simple view that creates a Model instance and binds the model properties to two labels.\r\n\r\nCode samples are here:\r\nhttps://gist.github.com/grantges/28241878e3886c1cec51\r\n\r\nWhen looking at the compiled JavaScript, you'll notice that the generated function to update the text properties on the bound Labels is being called twice.\r\n\r\nExpectation\r\nIt should only be called once per label/property", "attachment": [], "flagged": false, "summary": "Model Binding a View generates multiple calls to update the data of bound objects.", "creator": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "environment": "Alloy 1.3.1", "closedSprints": [ { "id": 117, "state": "closed", "name": "2014 Sprint 11 Alloy", "startDate": "2014-05-27T16:00:55.737Z", "endDate": "2014-06-07T04:00:00.000Z", "completeDate": "2014-06-09T14:18:58.490Z", "originBoardId": 124 } ], "comment": { "comments": [ { "id": "304644", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "[~fmiao] would you confirm this is still happening with Alloy 1.4? Thanks.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-13T19:26:01.000+0000", "updated": "2014-05-13T19:26:01.000+0000" }, { "id": "306399", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "[~skypanther] it's still happening with Alloy 1.4.0-alpha4.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-05-26T07:40:56.000+0000", "updated": "2014-05-26T07:40:56.000+0000" }, { "id": "306438", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR: https://github.com/appcelerator/alloy/pull/418\r\nTest app: https://github.com/feons/alloy/tree/ALOY-1000/test/apps/testing/ALOY-1000\r\n\r\nFunctional Test:\r\n 1. Run the test app on iOS \r\n 2. Check Resources/iphone/alloy/controllers/index.js:\r\n{code:javascript}\r\n 66 doClick ? $.__views.genre.addEventListener(\"click\", doClick) : __defers[\"$.__views.genre!click!doClick\"] = true;\r\n 67 var __alloyId4 = function() {\r\n 68 $.title.text = _.isFunction(Alloy.Models.book.transform) ? Alloy.Models.book.transform()[\"title\"] : Alloy.Models.book.get(\"title\");\r\n 69 $.author.text = _.isFunction(Alloy.Models.book.transform) ? Alloy.Models.book.transform()[\"author\"] : Alloy.Models.book.get(\"author\");\r\n 70 $.genre.text = _.isFunction(Alloy.Models.book.transform) ? Alloy.Models.book.transform()[\"genre\"] : Alloy.Models.book.get(\"genre\");\r\n 71 };\r\n 72 Alloy.Models.book.on(\"fetch change destroy\", __alloyId4);\r\n{code}\r\n 3. For each property, the update function is generated once.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-05-27T09:37:19.000+0000", "updated": "2014-05-27T09:37:19.000+0000" }, { "id": "306655", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "PR tested and merged", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-28T16:06:53.000+0000", "updated": "2014-05-28T16:06:53.000+0000" }, { "id": "320031", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified fix on:\r\n\r\nMac OSX 10.9.4\r\nAppcelerator Studio, build: 3.4.0.201408210941\r\nTitanium SDK build: 3.4.0.v20140821144114\r\nTitanium CLI, build: 3.4.0-dev\r\nAlloy: 1.5.0-dev\r\niOS Simulator 7.1\r\n\r\nBuilt the test to iOS and then checked Resources/iphone/alloy/controllers/index.js, the update function is generated once for each property.\r\n\r\n{code}\r\ndoClick ? $.__views.genre.addEventListener(\"click\", doClick) : __defers[\"$.__views.genre!click!doClick\"] = true;\r\n var __alloyId2 = function() {\r\n $.title.text = _.isFunction(Alloy.Models.book.transform) ? Alloy.Models.book.transform()[\"title\"] : _.template(\"<%=book.title%>\", {\r\n book: Alloy.Models.book.toJSON()\r\n });\r\n $.author.text = _.isFunction(Alloy.Models.book.transform) ? Alloy.Models.book.transform()[\"author\"] : _.template(\"<%=book.author%>\", {\r\n book: Alloy.Models.book.toJSON()\r\n });\r\n $.genre.text = _.isFunction(Alloy.Models.book.transform) ? Alloy.Models.book.transform()[\"genre\"] : _.template(\"<%=book.genre%>\", {\r\n book: Alloy.Models.book.toJSON()\r\n });\r\n };\r\n Alloy.Models.book.on(\"fetch change destroy\", __alloyId2);\r\n{code}\r\n\r\nClosing ticket.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-08-22T23:27:19.000+0000", "updated": "2014-08-22T23:27:19.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }