diff --git a/src/ParseObject.js b/src/ParseObject.js index 0bc3fcefb..9e6cf0e47 100644 --- a/src/ParseObject.js +++ b/src/ParseObject.js @@ -375,6 +375,9 @@ export default class ParseObject { changes[attr] = new ParseACL(response[attr]); } else if (attr !== 'objectId') { changes[attr] = decode(response[attr]); + if (changes[attr] instanceof UnsetOp) { + changes[attr] = undefined; + } } } if (changes.createdAt && !changes.updatedAt) { diff --git a/src/__tests__/ParseObject-test.js b/src/__tests__/ParseObject-test.js index 0fd8a9a5f..0407602fd 100644 --- a/src/__tests__/ParseObject-test.js +++ b/src/__tests__/ParseObject-test.js @@ -852,6 +852,21 @@ describe('ParseObject', () => { done(); }); })); + + it('interpolates delete operations', asyncHelper((done) => { + CoreManager.getRESTController()._setXHR( + mockXHR([{ + status: 200, + response: { objectId: 'newattributes', deletedKey: {__op: 'Delete'} } + }]) + ); + var o = new ParseObject('Item'); + o.save({ key: 'value', deletedKey: 'keyToDelete' }).then(() => { + expect(o.get('key')).toBe('value'); + expect(o.get('deletedKey')).toBeUndefined(); + done(); + }); + })); it('can make changes while in the process of a save', asyncHelper((done) => { var xhr = {