From 5fd401bfb628d92f3ca05857c7c78a775a65c1d3 Mon Sep 17 00:00:00 2001 From: BordedDev <> Date: Sun, 25 May 2025 02:23:52 +0200 Subject: [PATCH] Fixed double messaging when live typing --- src/snek/static/chat-input.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index a97b467..c356b20 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -191,9 +191,7 @@ levenshteinDistance(a, b) { e.preventDefault(); const message = me.replaceMentionsWithAuthors(this.value); - this.messageUid = null; - this.value = ""; - this.previousValue = ""; + e.target.value = ""; if (!message) { return; @@ -208,12 +206,11 @@ levenshteinDistance(a, b) { return; } - e.target.value = ""; + this.updateMessage() + this.value = ""; + this.previousValue = ""; this.messageUid = null; - this.sendMessage(this.channelUid, message).then((uid) => { - this.messageUid = uid; - }); } }); @@ -260,9 +257,11 @@ levenshteinDistance(a, b) { } this.sendMessage(this.channelUid, this.value).then((uid) => { - this.messageUid = uid; + if (this.liveType) { + this.messageUid = uid; + } }); - } + } updateMessage() { if (this.value[0] == "/") {