From 4ff07aa587a3cd59041fa88bba79f2794b84722f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 2 Aug 2023 12:06:22 +0200 Subject: [PATCH] fix: only pass callback in emit_update if given --- frontend/src/socket.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/socket.ts b/frontend/src/socket.ts index 1e06256..b6b10f9 100644 --- a/frontend/src/socket.ts +++ b/frontend/src/socket.ts @@ -15,5 +15,9 @@ export const emit_update = ( value: unknown, callback?: (ack: unknown) => void ) => { - socket.emit('frontend_update', { name, parent_path, value }, callback); + if (callback) { + socket.emit('frontend_update', { name, parent_path, value }, callback); + } else { + socket.emit('frontend_update', { name, parent_path, value }); + } };