From c1f7d2a9a6556e5a34fdf5ed38c77ce636f1ff02 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 17 Jul 2024 12:18:23 +0300 Subject: [PATCH] fix: don't call onConnect automatically (#3407) In some edge cases this causes issues. Leave it to the user to handle if necessary. --- lib/handler/decorator-handler.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/handler/decorator-handler.js b/lib/handler/decorator-handler.js index 9d2c4d0a34d..b0966c2eca9 100644 --- a/lib/handler/decorator-handler.js +++ b/lib/handler/decorator-handler.js @@ -1,11 +1,9 @@ 'use strict' const assert = require('node:assert') -const noop = () => {} module.exports = class DecoratorHandler { #handler - #onConnectCalled = false #onCompleteCalled = false #onErrorCalled = false @@ -17,16 +15,10 @@ module.exports = class DecoratorHandler { } onConnect (...args) { - this.#onConnectCalled = true return this.#handler.onConnect?.(...args) } onError (...args) { - if (!this.#onConnectCalled) { - this.#onConnectCalled = true - this.#handler.onConnect?.(noop) - } - this.#onErrorCalled = true return this.#handler.onError?.(...args) }