Skip to content

Commit e7379a4

Browse files
committed
Nullify batchRequestId immediatelly
Sometimes the library threw unhandledException that parseParams is undefined in parseResponse.js:312 It happens because a single requestId is assigned to two different requests, and after the first one is done, the info for second request is deleted. A single requestId is assigned because of the batch implementation. After executeBatch function, the global _batchRequestId is not nulled, so any further request will get the same requestId, until executeBatch promise is not finished.
1 parent 8e94116 commit e7379a4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/dynamics-web-api.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,11 +1474,10 @@ function DynamicsWebApi(config) {
14741474
request.collection = '$batch';
14751475

14761476
_isBatch = false;
1477+
_batchRequestId = null;
14771478
return _makeRequest('POST', request, 'executeBatch')
14781479
.then(function (response) {
14791480
return response.data;
1480-
}).finally(function () {
1481-
_batchRequestId = null;
14821481
});
14831482
};
14841483

0 commit comments

Comments
 (0)