@@ -87,7 +87,10 @@ function RestWrite(config, auth, className, query, data, originalData, clientSDK
8787 // Shared SchemaController to be reused to reduce the number of loadSchema() calls per request
8888 // Once set the schemaData should be immutable
8989 this . validSchemaController = null ;
90- this . pendingOps = { } ;
90+ this . pendingOps = {
91+ operations : null ,
92+ identifier : null ,
93+ } ;
9194}
9295
9396// A convenient method to perform all the steps of processing the
@@ -219,10 +222,13 @@ RestWrite.prototype.runBeforeSaveTrigger = function () {
219222 }
220223
221224 const { originalObject, updatedObject } = this . buildParseObjects ( ) ;
222-
225+ const identifier = updatedObject . _getStateIdentifier ( ) ;
223226 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+ } ;
226232
227233 return Promise . resolve ( )
228234 . then ( ( ) => {
@@ -1569,7 +1575,7 @@ RestWrite.prototype.runAfterSaveTrigger = function () {
15691575 . then ( result => {
15701576 const jsonReturned = result && ! result . _toFullJSON ;
15711577 if ( jsonReturned ) {
1572- this . pendingOps = { } ;
1578+ this . pendingOps . operations = { } ;
15731579 this . response . response = result ;
15741580 } else {
15751581 this . response . response = this . _updateResponseWithData (
@@ -1673,10 +1679,9 @@ RestWrite.prototype.cleanUserAuthData = function () {
16731679} ;
16741680
16751681RestWrite . prototype . _updateResponseWithData = function ( response , data ) {
1676- const { updatedObject } = this . buildParseObjects ( ) ;
16771682 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 ) {
16801685 if ( ! pending [ key ] ) {
16811686 data [ key ] = this . originalData ? this . originalData [ key ] : { __op : 'Delete' } ;
16821687 this . storage . fieldsChangedByTrigger . push ( key ) ;
0 commit comments