From e832af98546fba867864bdc9c4eac747d6e69fe3 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:12:41 +0300 Subject: [PATCH] Insert group chat history with splice --- public/scripts/group-chats.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index 3ce9f0d29..2396116d8 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -188,9 +188,7 @@ export async function getGroupChat(groupId, reload = false) { if (Array.isArray(data) && data.length) { data[0].is_group = true; - for (let key of data) { - chat.push(key); - } + chat.splice(0, chat.length, ...data); await printMessages(); } else { sendSystemMessage(system_message_types.GROUP, '', { isSmallSys: true });