From 39c78f37ceff9b8ec08329903dcba7bd53bd8661 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Wed, 15 Apr 2020 18:09:38 -0400 Subject: [PATCH] Fixed Contract filter never unsubscribing. --- packages/contracts/src.ts/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index 098e6f5e61..40c9eca32c 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -717,13 +717,13 @@ export class Contract { _checkRunningEvents(runningEvent: RunningEvent): void { if (runningEvent.listenerCount() === 0) { delete this._runningEvents[runningEvent.tag]; - } - // If we have a poller for this, remove it - const emit = this._wrappedEmits[runningEvent.tag]; - if (!emit) { - this.provider.off(runningEvent.filter, emit); - delete this._wrappedEmits[runningEvent.tag]; + // If we have a poller for this, remove it + const emit = this._wrappedEmits[runningEvent.tag]; + if (emit) { + this.provider.off(runningEvent.filter, emit); + delete this._wrappedEmits[runningEvent.tag]; + } } }