{"action":"opened","issue":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-JS/issues/91","labels_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-JS/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-JS/issues/91/comments","events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-JS/issues/91/events","html_url":"https://github.com/ParsePlatform/Parse-SDK-JS/issues/91","id":116613664,"number":91,"title":"Included objects decay to pointers when updating objects","user":{"login":"TylerBrock","id":280807,"avatar_url":"https://avatars.githubusercontent.com/u/280807?v=3","gravatar_id":"","url":"https://api.github.com/users/TylerBrock","html_url":"https://github.com/TylerBrock","followers_url":"https://api.github.com/users/TylerBrock/followers","following_url":"https://api.github.com/users/TylerBrock/following{/other_user}","gists_url":"https://api.github.com/users/TylerBrock/gists{/gist_id}","starred_url":"https://api.github.com/users/TylerBrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TylerBrock/subscriptions","organizations_url":"https://api.github.com/users/TylerBrock/orgs","repos_url":"https://api.github.com/users/TylerBrock/repos","events_url":"https://api.github.com/users/TylerBrock/events{/privacy}","received_events_url":"https://api.github.com/users/TylerBrock/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-12T18:42:22Z","updated_at":"2015-11-12T18:42:22Z","closed_at":null,"body":"We are seeing strange behavior that is different that that of the JS 1.5 and lower SDK in that when we update a field on an object that has included objects (fully hydrated), we see that the included objects decay to pointers after performing the update. We want to add this to the list of things we've discovered as blockers in #73.\r\n\r\nThis is a reproduction using the Parse JS SDK 1.6.9:\r\n\r\n**Setup**\r\n\r\n```js\r\nclass Brand extends Parse.Object {\r\n  constructor(attributes, options) {\r\n    super('Brand', attributes, options);\r\n  }\r\n}\r\nParse.Object.registerSubclass('Brand', Brand);\r\n\r\nclass Item extends Parse.Object {\r\n  constructor(attributes, options) {\r\n    super('Item', attributes, options);\r\n  }\r\n}\r\nParse.Object.registerSubclass('Item', Item);\r\n```\r\n\r\n**Test**\r\n```js\r\nvar freshItem = new Item({cool: true});\r\nvar freshBrand = new Brand({item: item});\r\n\r\nParse.Object.saveAll([freshItem, freshBrand]).then((brand, item) => {\r\n  var query = new Parse.Query(Brand);\r\n  query.include('item');\r\n  return query.get(brand.id);\r\n}).then((savedBrand) => {\r\n  var item = savedBrand.get('item');\r\n  assert(item.has(\"cool\"));  // has attributes of item (not decayed)\r\n  assert(item.get(\"cool\"));  // has attributes of item (not decayed)\r\n\r\n  // This update will cause included objects on savedBrand to decay.\r\n  brand.set('newField', true);\r\n\r\n  return brand.save().then((updatedBrand) => {\r\n    var item = savedBrand.get('item');\r\n    assert(item.has(\"cool\")); // fails, no attributes of item present (decayed)\r\n    assert(item.get(\"cool\")); // fails, no attributes of item present (decayed)\r\n  });\r\n})\r\n```\r\n\r\nWhen we attempt the same actions in the 1.5 SDK and lower the pointers do not decay (run line by line in our node REPL)\r\n\r\n```js\r\nvar Item = Parse.Object.extend(\"Item\")\r\nvar Brand = Parse.Object.extend(\"Brand\")\r\n\r\nvar brand = new Brand({name: \"Acme\"})\r\nvar item = new Item({brand: brand})\r\n\r\nitem.save()\r\n\r\nvar itemRef;\r\nvar itemQuery = new Parse.Query(Item);\r\nitemQuery.include(\"brand\").get(\"n0EnLswyJv\").then(function(fetchedItem) {\r\n  itemRef = fetchedItem;\r\n})\r\n\r\nitemRef.get(\"brand\").get(\"name\")\r\n> 'Acme'\r\n\r\nitemRef.set(\"price\", 30)\r\nitemRef.save()\r\nitemRef.get(\"brand\").get(\"name\")\r\n> 'Acme'\r\n```"}}