From 00f368b6cc6dbca7eddf261e1042e19c735f188c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hor=C5=88=C3=A1k?= Date: Thu, 20 Apr 2023 15:20:43 +0200 Subject: [PATCH] fix: array clone before revers --- src/routes/ChatRoute.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/ChatRoute.tsx b/src/routes/ChatRoute.tsx index 57903a3..79e1654 100644 --- a/src/routes/ChatRoute.tsx +++ b/src/routes/ChatRoute.tsx @@ -203,7 +203,7 @@ export function ChatRoute() { event.preventDefault(); const newMsgIndex = userMsgIndex + (event.code === "ArrowUp" ? 1 : -1); - const allMessages = [contentDraft, ...userMessages.reverse()]; + const allMessages = [contentDraft, ...Array.from(userMessages).reverse()]; if (newMsgIndex < 0 || newMsgIndex >= allMessages.length) { // index out of range, do nothing