From 9aebeeac0227ca72b8fe468ef7299b53a4d2fad0 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 11 Sep 2021 17:42:26 +0200 Subject: [PATCH] Fix offSlaveUpdate and offSaveListUpdate Fix unreachable code and use of slice instead splice turning offSlaveUpdate and offSaveListUpdate into no-ops. --- packages/web_ui/src/util/websocket.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/web_ui/src/util/websocket.jsx b/packages/web_ui/src/util/websocket.jsx index d7a1443f..aab12ecf 100644 --- a/packages/web_ui/src/util/websocket.jsx +++ b/packages/web_ui/src/util/websocket.jsx @@ -133,7 +133,7 @@ export class Control extends libLink.Link { throw new Error(`Given handler is not registered for slave ${id}`); } - handlers.slice(index, 1); + handlers.splice(index, 1); if (!handlers.length) { this.slaveUpdateHandlers.delete(id); await this.updateSlaveSubscriptions(); @@ -242,12 +242,12 @@ export class Control extends libLink.Link { let index = handlers.lastIndexOf(handler); if (index === -1) { throw new Error(`Given handler is not registered for instance ${id}`); + } - handlers.splice(index, 1); - if (!handlers.length) { - this.saveListUpdateHandlers.delete(id); - await this.updateSaveListSubscriptions(); - } + handlers.splice(index, 1); + if (!handlers.length) { + this.saveListUpdateHandlers.delete(id); + await this.updateSaveListSubscriptions(); } }