Fix for beforeSave with increment causing key to be Dropped (#4259)
* Fixes an issue where a beforeSave hook could cause a numeric val to be dropped in response. * Use hasOwnProperty to check instead * Remove redundant set
This commit is contained in:
committed by
GitHub
parent
557a2b2827
commit
315d30b426
@@ -1195,9 +1195,10 @@ RestWrite.prototype._updateResponseWithData = function(response, data) {
|
||||
const clientSupportsDelete = ClientSDK.supportsForwardDelete(this.clientSDK);
|
||||
this.storage.fieldsChangedByTrigger.forEach(fieldName => {
|
||||
const dataValue = data[fieldName];
|
||||
const responseValue = response[fieldName];
|
||||
|
||||
response[fieldName] = responseValue || dataValue;
|
||||
if(!response.hasOwnProperty(fieldName)) {
|
||||
response[fieldName] = dataValue;
|
||||
}
|
||||
|
||||
// Strips operations from responses
|
||||
if (response[fieldName] && response[fieldName].__op) {
|
||||
|
||||
Reference in New Issue
Block a user