{ "id": "159105", "key": "ALOY-1477", "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": "18001", "name": "Release 5.2.2", "archived": false, "released": true, "releaseDate": "2016-06-28" }, { "id": "18003", "name": "alloy 1.8.4", "archived": false, "released": true, "releaseDate": "2016-03-29" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-29T17:37:52.000+0000", "created": "2016-03-29T10:06:01.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "17974", "name": "alloy 1.8.0", "archived": false, "released": true, "releaseDate": "2016-03-16" }, { "id": "17997", "name": "alloy 1.8.3", "archived": false, "released": true, "releaseDate": "2016-03-28" } ], "issuelinks": [ { "id": "51177", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "159103", "key": "AC-3420", "fields": { "summary": "Error with models in the new Appcelerator update", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "51176", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "155773", "key": "ALOY-1369", "fields": { "summary": "Complex data binding for collection doesn't work with transform", "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" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "updated": "2016-03-31T23:24:36.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": "ALOY-1369 solved one data-binding issue, but uncovered another.\r\n\r\n{{_.template()}} demands all variables used in a template to exist. Now ALOY-1369 uses this method apps will error if this is not the case. A very typical use case is when you add a new model to a collection and use an auto incremented primary key. In this case that field will be empty when Alloy first updates the UI in response to {{create}}. Once the model has been synced to the DB Alloy would update the UI again to show the now populated field. But since Alloy 1.8.0 it would never get there because of the error.\r\n\r\nThe solution is likely to be found in how we use {{_.template()}} for model data-binding. Here don't pass the individual model fields as variables but the object as a whole. {{_.template()}} seems to have no problem with properties of that object being empty and simply renders an empty string.\r\n\r\n*index.xml*\r\n\r\n{code:xml}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*index.js*\r\n\r\n{code:js}\r\nAlloy.Models.mymodel.set({\r\n id: 0,\r\n title: 'mod TITLE'\r\n});\r\n\r\nAlloy.Collections.mymodel.reset([{\r\n id: 0,\r\n title: 'col TITLE'\r\n}]);\r\n\r\n$.index.open();\r\n\r\nfunction createModel() {\r\n Alloy.Collections.mymodel.create({\r\n title: 'crt TITLE'\r\n });\r\n}\r\n{code}\r\n\r\n*mymodel.js*\r\n\r\n{code:js}\r\nexports.definition = {\r\n config: {\r\n \"columns\": {\r\n \"id\": \"INTEGER PRIMARY KEY AUTOINCREMENT\",\r\n \"title\": \"TEXT\"\r\n },\r\n \"adapter\": {\r\n \"type\": \"sql\",\r\n \"collection_name\": \"mymodel\",\r\n \"idAttribute\": \"id\"\r\n }\r\n }\r\n};\r\n{code}\r\n\r\n*Template code*\r\n\r\n{code:js}\r\n[INFO] var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\r\n[INFO] with(obj||{}){\r\n[INFO] __p+='{mymodel.id} - {mymodel.title}';\r\n[INFO] }\r\n[INFO] return __p;\r\n[INFO]\r\n[INFO] var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\r\n[INFO] with(obj||{}){\r\n[INFO] __p+=''+\r\n[INFO] ((__t=(id))==null?'':__t)+\r\n[INFO] ' - '+\r\n[INFO] ((__t=(title))==null?'':__t)+\r\n[INFO] '';\r\n[INFO] }\r\n[INFO] return __p;\r\n{code}\r\n\r\n*Error*\r\n\r\n{code}\r\n[ERROR] Script Error {\r\n[ERROR] column = 10;\r\n[ERROR] line = 4;\r\n[ERROR] message = \"Can't find variable: id\";\r\n{code}\r\n\r\nFound by SO user:\r\nhttp://stackoverflow.com/questions/36274177/alloy-data-binding-error-after-alloy-1-8-upgrade", "attachment": [], "flagged": false, "summary": "Regression: Missing model attributes cause error on collection data binding", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": null, "closedSprints": [ { "id": 615, "state": "closed", "name": "2016 Sprint 07 Tooling", "startDate": "2016-03-26T00:40:48.770Z", "endDate": "2016-04-09T00:40:00.000Z", "completeDate": "2016-04-11T04:48:57.781Z", "originBoardId": 121 } ], "comment": { "comments": [ { "id": "380916", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "PR: https://github.com/appcelerator/alloy/pull/778\r\n\r\nTo test:\r\n\r\n1. Run {{jake app:run dir=testing/ALOY-1234}} with Alloy 1.8.3 and confirm the spec fails\r\n2. Run again with fix and confirm the spec passes", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-29T11:51:42.000+0000", "updated": "2016-03-29T11:51:42.000+0000" }, { "id": "380966", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR merged.\r\nAlloy@1.8.4", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2016-03-29T17:37:52.000+0000", "updated": "2016-03-29T17:37:52.000+0000" }, { "id": "381020", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "with Alloy 1.8.4 the problem still happen....", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-30T09:52:24.000+0000", "updated": "2016-03-30T09:52:24.000+0000" }, { "id": "381022", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~amurcia] could you give me a reproducible test case? The test case included in the description and PR test app does work with 1.8.4", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-30T10:09:12.000+0000", "updated": "2016-03-30T10:09:12.000+0000" }, { "id": "381024", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes, this is my example:\r\n\r\nModel definition: http://pastebin.com/AhnPBQ2q\r\nCode: http://pastebin.com/du95qk2r\r\n\r\n", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-30T10:31:06.000+0000", "updated": "2016-03-30T10:31:06.000+0000" }, { "id": "381026", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~amurcia] Let's chat on TiSlack (fokkezb) or Skype (fokke.zandbergen).\r\n\r\nI took some changes to get those snippets work at all and after it did it worked on both Alloy 1.7.35 and 1.8.4 for me:\r\n\r\nhttp://get.fokkezb.nl/_/5mhW77c", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-30T10:55:54.000+0000", "updated": "2016-03-30T10:55:54.000+0000" }, { "id": "381027", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It works now doing this at console:\r\n\r\nappc use 5.2.1-12\r\n\r\n\r\nfrom here: http://www.appcelerator.com/blog/2016/03/release-candidates-for-titanium-appcelerator-cli-5-2-1/#comment-157507\r\n", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-30T11:19:59.000+0000", "updated": "2016-03-30T11:20:21.000+0000" }, { "id": "381028", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~amurcia] if you are using the {{appc}} CLI then that will use the Alloy CLI bundled with what you select via {{appc use}}. You can see the Alloy version via {{appc alloy -v}}. Could you let me know what Alloy version it was that was failing?\r\n\r\nBTW, {{appc use 5.2.1}} will get you the GA version of 5.2.1-12", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-30T11:23:21.000+0000", "updated": "2016-03-30T11:23:21.000+0000" }, { "id": "381029", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "appc 5.0.6 with alloy 1.8.4 -> FAIL\r\nappc 5.2.1-12 with alloy 1.8.4 -> OK", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-30T11:29:35.000+0000", "updated": "2016-03-30T11:29:35.000+0000" }, { "id": "381031", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~amurcia] I'm sorry but here's no {{appc use 5.0.6}} and {{appc use 5.2.1-12}} comes with Alloy 1.7.35 ({{appc alloy -v}}). Could you double check?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-30T11:34:48.000+0000", "updated": "2016-03-30T11:34:48.000+0000" }, { "id": "381032", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is my config now:\r\n\r\n$ appc -v\r\n5.2.1-12\r\n$ alloy -v\r\n1.8.4\r\n$ appc alloy -v\r\n1.7.35\r\n\r\nMy config before:\r\n\r\nNode.js Version = 0.12.7\r\nCLI Version = 5.0.6\r\n$ npm -v\r\n2.11.3\r\n$ ti -v\r\n5.0.5\r\n$ alloy -v\r\n1.7.19\r\n", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-30T11:39:01.000+0000", "updated": "2016-03-30T11:39:01.000+0000" }, { "id": "381090", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "So it worked when you used {{ti build}} with Alloy 1.7.19 and it failed when you run via {{appc run}} with Alloy 1.7.35?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-30T20:35:13.000+0000", "updated": "2016-03-30T20:35:13.000+0000" }, { "id": "381140", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-31T06:12:19.000+0000", "updated": "2016-03-31T06:12:19.000+0000" }, { "id": "381148", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~amurcia] I ran http://get.fokkezb.nl/_/5mhW77c with both Alloy 1.7.19 and 1.7.35 and both work. I'm using SDK 5.2.1.GA in both cases. Can you verify using the same test case? Please create a new JIRA ticket if you manage to get a reproducible test case.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-31T06:59:07.000+0000", "updated": "2016-03-31T06:59:07.000+0000" }, { "id": "381151", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm using SDK 5.1.2.GA", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-31T08:06:12.000+0000", "updated": "2016-03-31T08:06:12.000+0000" }, { "id": "381154", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~amurcia] just tested both Alloy versions with SDK 5.1.2.GA and still works. Please try to get the linked test case to fail and open a new JIRA ticket if you succeed in failing ;)", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-31T08:30:03.000+0000", "updated": "2016-03-31T08:30:03.000+0000" }, { "id": "381155", "author": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "body": "ok", "updateAuthor": { "name": "amurcia", "key": "amurcia", "displayName": "Anna", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-31T08:32:17.000+0000", "updated": "2016-03-31T08:32:17.000+0000" }, { "id": "381248", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11.4 (15E65)\r\nStudio 4.5.0.201602170821\r\nTi SDK 5.2.2.v20160328141205\r\nAppc NPM 4.2.5-1\r\nAppc CLI 5.2.2-3\r\nAlloy 1.8.5\r\nXcode 7.3 (7D175)\r\n\r\nMissing model attributes no longer cause an error. Tested with provided test case and project provided by a user, in addition to a created test case. No errors encountered and blank strings are rendered instead.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-03-31T23:24:36.000+0000", "updated": "2016-03-31T23:24:36.000+0000" } ], "maxResults": 18, "total": 18, "startAt": 0 } } }