{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1840","repository_url":"https://api.github.com/repos/ParsePlatform/parse-server","labels_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1840/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1840/comments","events_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1840/events","html_url":"https://github.com/ParsePlatform/parse-server/issues/1840","id":155711963,"number":1840,"title":"ParseObject still has deleteOperation in field after saveCallback, when using beforeSave in Cloud","user":{"login":"pargu","id":19467727,"avatar_url":"https://avatars.githubusercontent.com/u/19467727?v=3","gravatar_id":"","url":"https://api.github.com/users/pargu","html_url":"https://github.com/pargu","followers_url":"https://api.github.com/users/pargu/followers","following_url":"https://api.github.com/users/pargu/following{/other_user}","gists_url":"https://api.github.com/users/pargu/gists{/gist_id}","starred_url":"https://api.github.com/users/pargu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pargu/subscriptions","organizations_url":"https://api.github.com/users/pargu/orgs","repos_url":"https://api.github.com/users/pargu/repos","events_url":"https://api.github.com/users/pargu/events{/privacy}","received_events_url":"https://api.github.com/users/pargu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-19T11:13:15Z","updated_at":"2016-05-29T00:08:19Z","closed_at":null,"body":"Reproduce:\r\n1. Set remove / removeKey on a field on a ParseObject and save object with block (using beforeSave on Cloud for object - only returning response.success())\r\n2. Logging object after save has been done in block still contains deleteOperation for the field. On server side all is fine, with the right values set (value removed).\r\n3. Later on trying to save new value to same field causing \"Operation is invalid after previous operation\", because you are trying to add to a field that has a deleteOperation still in it and trying to save said object.\r\n\r\nHacks\r\n 1. Add empty string to field instead of remove / removeKey (null checks can't be made later on)\r\n 2. Create a new ParseObject and init old object into it, before saving the second time (Everything goes fine, cache:ing is lost if you need to update something in views in previous screens which are connected to original object. This hack does not support ParseInstallation and ParseUser)\r\n 3. Fetch object again in saveCallback (Not very efficient)\r\n\r\n\r\n\r\n \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/comments/222335463","html_url":"https://github.com/ParsePlatform/parse-server/issues/1840#issuecomment-222335463","issue_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1840","id":222335463,"user":{"login":"airdrummingfool","id":631249,"avatar_url":"https://avatars.githubusercontent.com/u/631249?v=3","gravatar_id":"","url":"https://api.github.com/users/airdrummingfool","html_url":"https://github.com/airdrummingfool","followers_url":"https://api.github.com/users/airdrummingfool/followers","following_url":"https://api.github.com/users/airdrummingfool/following{/other_user}","gists_url":"https://api.github.com/users/airdrummingfool/gists{/gist_id}","starred_url":"https://api.github.com/users/airdrummingfool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airdrummingfool/subscriptions","organizations_url":"https://api.github.com/users/airdrummingfool/orgs","repos_url":"https://api.github.com/users/airdrummingfool/repos","events_url":"https://api.github.com/users/airdrummingfool/events{/privacy}","received_events_url":"https://api.github.com/users/airdrummingfool/received_events","type":"User","site_admin":false},"created_at":"2016-05-29T00:08:19Z","updated_at":"2016-05-29T00:08:19Z","body":"I'm running into this on both platforms I use (iOS and in JS) when I `unset()` a key in cloud code on an object that has a beforeSave. I'll write up a test that shows the issue."}}
{"actor":{"display_login":"airdrummingfool"}}