From d5deb6d2a0045ed4856a8181924fd30fa50b946e Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 13 Aug 2024 11:18:30 -0400 Subject: [PATCH] Only report each unknown message type once (#402) --- src/scripts/api.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scripts/api.ts b/src/scripts/api.ts index bd613be7bf..b97076c04a 100644 --- a/src/scripts/api.ts +++ b/src/scripts/api.ts @@ -30,6 +30,8 @@ class ComfyApi extends EventTarget { socket?: WebSocket clientId?: string + reportedUnknownMessageTypes = new Set() + constructor() { super() this.api_host = location.host @@ -206,7 +208,8 @@ class ComfyApi extends EventTarget { this.dispatchEvent( new CustomEvent(msg.type, { detail: msg.data }) ) - } else { + } else if (!this.reportedUnknownMessageTypes.has(msg.type)) { + this.reportedUnknownMessageTypes.add(msg.type) throw new Error(`Unknown message type ${msg.type}`) } }