From 5861bb4e7276f3dc0fb07d8c6bd419a60ad939e7 Mon Sep 17 00:00:00 2001 From: wisplite Date: Thu, 23 Apr 2026 08:58:37 -0500 Subject: [PATCH] fixed a shadowing bug --- src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 132236b..8c7a090 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,14 +52,15 @@ export class TetherClient { mutation_id: mutation_id })); return new Promise((resolve, reject) => { - this.websocketHandler.onMutation = (mutation_id: string, data: any) => { - if (mutation_id === mutation_id) { + const timeoutId = setTimeout(() => { + reject(new Error('Mutation timeout')); + }, 10000); + this.websocketHandler.onMutation = (incoming_id: string, data: any) => { + if (incoming_id === mutation_id) { + clearTimeout(timeoutId); resolve(data); } }; - setTimeout(() => { - reject(new Error('Mutation timeout')); - }, 10000); }); }; } \ No newline at end of file