From 0c00896c9b410ced8124058261b19703dbe57c01 Mon Sep 17 00:00:00 2001 From: parag-pv Date: Wed, 7 Aug 2024 14:20:33 -0400 Subject: [PATCH] Fix: Listeners not honoring multiple failures for subscription in JS (#202) * Initial commit. Removing listener from promise list * Using the existing remove function instead. Updated comment --- languages/javascript/src/shared/Events/index.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/languages/javascript/src/shared/Events/index.mjs b/languages/javascript/src/shared/Events/index.mjs index 18c2092a..bc458934 100644 --- a/languages/javascript/src/shared/Events/index.mjs +++ b/languages/javascript/src/shared/Events/index.mjs @@ -177,6 +177,9 @@ const doListen = function(module, event, callback, context, once, internal=false resolve(listenerId) } else { + // Remove the listener from external list on failure to subscribe + // TODO: Instead of removing, the failed subscription shouldn't be put into the external list + listeners.remove(listenerId) reject(error) } }) @@ -184,7 +187,6 @@ const doListen = function(module, event, callback, context, once, internal=false else { resolve(listenerId) } - return p } }