diff --git a/src/utilities/observables/asyncMap.ts b/src/utilities/observables/asyncMap.ts index 5f77ffa1143..8e9ecb9b17d 100644 --- a/src/utilities/observables/asyncMap.ts +++ b/src/utilities/observables/asyncMap.ts @@ -33,20 +33,21 @@ export function asyncMap( .then(both, both) .then( (result) => { - --activeCallbackCount; next && next.call(observer, result); - if (completed) { - handler.complete!(); - } }, (error) => { - --activeCallbackCount; throw error; } ) .catch((caught) => { error && error.call(observer, caught); }); + promiseQueue.finally(() => { + --activeCallbackCount; + if (completed) { + handler.complete!(); + } + }); }; } else { return (arg) => delegate && delegate.call(observer, arg);