@@ -87,7 +87,10 @@ function RestWrite(config, auth, className, query, data, originalData, clientSDK
87
87
// Shared SchemaController to be reused to reduce the number of loadSchema() calls per request
88
88
// Once set the schemaData should be immutable
89
89
this . validSchemaController = null ;
90
- this . pendingOps = { } ;
90
+ this . pendingOps = {
91
+ operations : null ,
92
+ identifier : null ,
93
+ } ;
91
94
}
92
95
93
96
// A convenient method to perform all the steps of processing the
@@ -219,10 +222,13 @@ RestWrite.prototype.runBeforeSaveTrigger = function () {
219
222
}
220
223
221
224
const { originalObject, updatedObject } = this . buildParseObjects ( ) ;
222
-
225
+ const identifier = updatedObject . _getStateIdentifier ( ) ;
223
226
const stateController = Parse . CoreManager . getObjectStateController ( ) ;
224
- const [ pending ] = stateController . getPendingOps ( updatedObject . _getStateIdentifier ( ) ) ;
225
- this . pendingOps = { ...pending } ;
227
+ const [ pending ] = stateController . getPendingOps ( identifier ) ;
228
+ this . pendingOps = {
229
+ operations : { ...pending } ,
230
+ identifier,
231
+ } ;
226
232
227
233
return Promise . resolve ( )
228
234
. then ( ( ) => {
@@ -1569,7 +1575,7 @@ RestWrite.prototype.runAfterSaveTrigger = function () {
1569
1575
. then ( result => {
1570
1576
const jsonReturned = result && ! result . _toFullJSON ;
1571
1577
if ( jsonReturned ) {
1572
- this . pendingOps = { } ;
1578
+ this . pendingOps . operations = { } ;
1573
1579
this . response . response = result ;
1574
1580
} else {
1575
1581
this . response . response = this . _updateResponseWithData (
@@ -1673,10 +1679,9 @@ RestWrite.prototype.cleanUserAuthData = function () {
1673
1679
} ;
1674
1680
1675
1681
RestWrite . prototype . _updateResponseWithData = function ( response , data ) {
1676
- const { updatedObject } = this . buildParseObjects ( ) ;
1677
1682
const stateController = Parse . CoreManager . getObjectStateController ( ) ;
1678
- const [ pending ] = stateController . getPendingOps ( updatedObject . _getStateIdentifier ( ) ) ;
1679
- for ( const key in this . pendingOps ) {
1683
+ const [ pending ] = stateController . getPendingOps ( this . pendingOps . identifier ) ;
1684
+ for ( const key in this . pendingOps . operations ) {
1680
1685
if ( ! pending [ key ] ) {
1681
1686
data [ key ] = this . originalData ? this . originalData [ key ] : { __op : 'Delete' } ;
1682
1687
this . storage . fieldsChangedByTrigger . push ( key ) ;
0 commit comments