{ "id": "174507", "key": "AC-6452", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": null, "resolutiondate": null, "created": "2019-12-03T08:19:15.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-12-03T22:24:03.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." } ], "description": "EDIT: Updated with working error example:\r\n\r\nThis [commit|https://github.com/appcelerator/alloy/commit/0d6a312cfa42d82919b695f38583a31cbedeb9c2#diff-a59a2178e486f81366775c39e5393695] brokes this use case:\r\n\r\n- Custom mapping object with *$model.__transform* property\r\n\r\nExample:\r\n\r\nIt's my fault Ewan. Try passing a deep object:\r\n\r\n\r\n{noformat}\r\n[ERROR] Script Error {\r\n[ERROR] column = 385;\r\n[ERROR] line = 49;\r\n[ERROR] message = \"undefined is not an object (evaluating 'Alloy['Models']['user'].on')\";\r\n[ERROR] sourceURL = \"file:///Users/jormagar/Library/Developer/CoreSimulator/Devices/E90BCD03-DD1A-4ED4-A53E-E855EAF8D0F7/data/Containers/Bundle/Application/1285D017-A679-4740-AF70-0C257BD62EAF/AlloyDeepBinding.app/alloy/controllers/detail.js\";\r\n[ERROR] stack = \" at Controller(/alloy/controllers/detail.js:49:385)\\n at (/alloy.js:428:53)\\n at doClick(/alloy/controllers/index.js:54:27)\";\r\n[ERROR] toJSON = \"\";\r\n[ERROR] } \r\n{noformat}\r\n\r\n{code:xml}\r\n//detail.xml\r\n\r\n \r\n \r\n\r\n{code}\r\n\r\n{code:javascript}\r\n\r\n//index.js\r\n function onClick() {\r\n Alloy.createController('MyView', {\r\n $model: {\r\n __transform: {\r\n user: {\r\n owner: {\r\n name: 'Bob'\r\n },\r\n contributor: {\r\n name: 'Tom'\r\n }\r\n }\r\n }\r\n }\r\n }).getView().open();\r\n }\r\n\r\n$.index.open();\r\n\r\n{code}\r\n\r\nComing back to the previous code before commit fixes it.\r\n", "attachment": [], "flagged": false, "summary": "Alloy custom $model.__transform mapping is broken", "creator": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "subtasks": [], "reporter": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "environment": "Appc CLI: 7.1.2\r\nAlloy CLI: 1.14.4\r\nTitanium CLI: 5.2.2\r\nTitanium SDK: 8.3.0 GA", "comment": { "comments": [ { "id": "453000", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~jormagar] could you elaborate a little more as to what the expected outcome is here, my code is below. When using the latest version of alloy (1.14.5) and building to an iOS simulator, I'm seeing two labels with \"Bob\" and \"Bobson\" after clicking on the button, when I revert the referenced commit I see exactly the same.\r\n\r\nTo me the behaviour I'm seeing is expected, am I wrong? Am I creating the test case incorrectly?\r\n\r\nWhen\r\n{code: title=index.xml}\r\n\r\n\t\r\n \r\n\t\r\n\r\n{code}\r\n\r\n{code: title=index.js}\r\nfunction onClick() {\r\n\tAlloy.createController('MyView', {\r\n\t\t$model: {\r\n\t\t __transform: {\r\n\t\t\tname: 'Bob',\r\n\t\t\tsurname: 'Bobson'\r\n\t\t }\r\n\t\t}\r\n\t }).getView().open();\r\n}\r\n\r\n$.index.open();\r\n{code}\r\n\r\n{code: title=MyView.xml}\r\n\r\n \r\n \r\n\r\n{code}", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2019-12-03T12:07:50.000+0000", "updated": "2019-12-03T12:07:50.000+0000" }, { "id": "453001", "author": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "body": "It's my fault Ewan. Try passing a deep object:\r\n\r\n\r\n{noformat}\r\n[ERROR] Script Error {\r\n[ERROR] column = 385;\r\n[ERROR] line = 49;\r\n[ERROR] message = \"undefined is not an object (evaluating 'Alloy['Models']['user'].on')\";\r\n[ERROR] sourceURL = \"file:///Users/jormagar/Library/Developer/CoreSimulator/Devices/E90BCD03-DD1A-4ED4-A53E-E855EAF8D0F7/data/Containers/Bundle/Application/1285D017-A679-4740-AF70-0C257BD62EAF/AlloyDeepBinding.app/alloy/controllers/detail.js\";\r\n[ERROR] stack = \" at Controller(/alloy/controllers/detail.js:49:385)\\n at (/alloy.js:428:53)\\n at doClick(/alloy/controllers/index.js:54:27)\";\r\n[ERROR] toJSON = \"\";\r\n[ERROR] } \r\n{noformat}\r\n\r\n\r\n{code:javascript}\r\n//detail.xml\r\n\r\n \r\n \r\n\r\n\r\n//index.js\r\n function onClick() {\r\n Alloy.createController('MyView', {\r\n $model: {\r\n __transform: {\r\n user: {\r\n owner: {\r\n name: 'Bob'\r\n },\r\n contributor: {\r\n name: 'Tom'\r\n }\r\n }\r\n }\r\n }\r\n }).getView().open();\r\n }\r\n\r\n$.index.open();\r\n\r\n{code}\r\n", "updateAuthor": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "created": "2019-12-03T12:16:39.000+0000", "updated": "2019-12-03T13:19:43.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }