{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/ParseReact/issues/27","labels_url":"https://api.github.com/repos/ParsePlatform/ParseReact/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/ParseReact/issues/27/comments","events_url":"https://api.github.com/repos/ParsePlatform/ParseReact/issues/27/events","html_url":"https://github.com/ParsePlatform/ParseReact/issues/27","id":71167743,"number":27,"title":"Issue with Set Mutations","user":{"login":"agnosticdev","id":7466510,"avatar_url":"https://avatars.githubusercontent.com/u/7466510?v=3","gravatar_id":"","url":"https://api.github.com/users/agnosticdev","html_url":"https://github.com/agnosticdev","followers_url":"https://api.github.com/users/agnosticdev/followers","following_url":"https://api.github.com/users/agnosticdev/following{/other_user}","gists_url":"https://api.github.com/users/agnosticdev/gists{/gist_id}","starred_url":"https://api.github.com/users/agnosticdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agnosticdev/subscriptions","organizations_url":"https://api.github.com/users/agnosticdev/orgs","repos_url":"https://api.github.com/users/agnosticdev/repos","events_url":"https://api.github.com/users/agnosticdev/events{/privacy}","received_events_url":"https://api.github.com/users/agnosticdev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-27T03:45:14Z","updated_at":"2015-04-28T03:30:48Z","closed_at":null,"body":"I have been experiencing issues with Set Mutations.  Every time I try and create a very basic Set Mutation, like so:\r\n\r\n``` js\r\nvar dispatch_activity = ParseReact.Mutation.Set(parseObj.id, { update_field: String(c) } );\r\n\r\n///\r\ndispatch_activity.dispatch();\r\n\r\n```\r\nI would get the following error:\r\n```\r\nUncaught TypeError: Cannot read property 'className' of undefined   parse-react.js:2497\r\n```\r\nBased upon the documentation and the [todo Demo](https://github.com/ParsePlatform/ParseReact/blob/master/demos/todo/js/TodoList.react.js) it looked like my code was correct, so I thought I would take a look at the code in parse-react.js at 2497. \r\n\r\nOn the code in parse-react.js it looks like the ```changes``` object is referencing ```id.className``` from the ```latest``` object, which I found not to hold that data.   Here is the snippet I am referring to:\r\n\r\n```js\r\nvar potentials = SubscriptionManager.queriesForFields(changes.latest.id.className, changes.fields);\r\n  for (i = 0; i < potentials.length; i++) {\r\n    if (visited[potentials[i]]) {\r\n      continue;\r\n    }\r\n    subscriber = SubscriptionManager.getSubscription(potentials[i]);\r\n    if (QueryTools.matchesQuery(changes.latest, subscriber.originalQuery)) {\r\n      subscriber.addResult(changes.latest);\r\n      ObjectStore.addSubscriber(changes.latest.id, potentials[i]);\r\n    }\r\n  }\r\n  if (changes.latest.id.className === '_User') {\r\n    var currentUser = Parse.User.current();\r\n    if (currentUser && changes.latest.id.objectId === currentUser.id) {\r\n      LocalSubscriptions.currentUser.update(changes.latest);\r\n    }\r\n  }\r\n```\r\n\r\nIf I reworked this block of code for ```changes``` to reference ```id.className``` directly then everything worked perfectly in my Set Mutation.  Like so:\r\n\r\n```js\r\n  var potentials = SubscriptionManager.queriesForFields(changes.id.className, changes.fields);\r\n  for (i = 0; i < potentials.length; i++) {\r\n    if (visited[potentials[i]]) {\r\n      continue;\r\n    }\r\n    subscriber = SubscriptionManager.getSubscription(potentials[i]);\r\n    if (QueryTools.matchesQuery(changes.latest, subscriber.originalQuery)) {\r\n      subscriber.addResult(changes.latest);\r\n      ObjectStore.addSubscriber(changes.id, potentials[i]);\r\n    }\r\n  }\r\n  if (changes.id.className === '_User') {\r\n    var currentUser = Parse.User.current();\r\n    if (currentUser && changes.id.objectId === currentUser.id) {\r\n      LocalSubscriptions.currentUser.update(changes.latest);\r\n    }\r\n  }\r\n```\r\n\r\nJust wondering if anyone else has seen this issue or if it is something that I am possibly doing wrong.\r\n"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/ParseReact/issues/comments/96896178","html_url":"https://github.com/ParsePlatform/ParseReact/issues/27#issuecomment-96896178","issue_url":"https://api.github.com/repos/ParsePlatform/ParseReact/issues/27","id":96896178,"user":{"login":"agnosticdev","id":7466510,"avatar_url":"https://avatars.githubusercontent.com/u/7466510?v=3","gravatar_id":"","url":"https://api.github.com/users/agnosticdev","html_url":"https://github.com/agnosticdev","followers_url":"https://api.github.com/users/agnosticdev/followers","following_url":"https://api.github.com/users/agnosticdev/following{/other_user}","gists_url":"https://api.github.com/users/agnosticdev/gists{/gist_id}","starred_url":"https://api.github.com/users/agnosticdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agnosticdev/subscriptions","organizations_url":"https://api.github.com/users/agnosticdev/orgs","repos_url":"https://api.github.com/users/agnosticdev/repos","events_url":"https://api.github.com/users/agnosticdev/events{/privacy}","received_events_url":"https://api.github.com/users/agnosticdev/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T03:30:48Z","updated_at":"2015-04-28T03:30:48Z","body":"@andrewimm thank you very much, I appreciate it!  There is the workaround that I described above:\r\n\r\n```js\r\n  var potentials = SubscriptionManager.queriesForFields(changes.id.className, changes.fields);\r\n  for (i = 0; i < potentials.length; i++) {\r\n    if (visited[potentials[i]]) {\r\n      continue;\r\n    }\r\n    subscriber = SubscriptionManager.getSubscription(potentials[i]);\r\n    if (QueryTools.matchesQuery(changes.latest, subscriber.originalQuery)) {\r\n      subscriber.addResult(changes.latest);\r\n      ObjectStore.addSubscriber(changes.id, potentials[i]);\r\n    }\r\n  }\r\n  if (changes.id.className === '_User') {\r\n    var currentUser = Parse.User.current();\r\n    if (currentUser && changes.id.objectId === currentUser.id) {\r\n      LocalSubscriptions.currentUser.update(changes.latest);\r\n    }\r\n  }\r\n```\r\n\r\nI can just work locally with this temporary fix until the new release is out. \r\nAgain, thank you very much."}}