fix: call stack size exceeded

The spread operator will place the arguments, which can reach the call
stack limit if too many messages are being sent. This fix uses
`.concat()` to avoid the spread operator.

Fixes #5022
This commit is contained in:
Tiago de Paula 2026-01-31 20:54:52 -03:00
commit 03d01bb1d6
No known key found for this signature in database
GPG key ID: 55BD118E42C985CF
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ socket.on("more", async (data) => {
);
channel.moreHistoryAvailable =
data.totalMessages > channel.messages.length + data.messages.length;
channel.messages.unshift(...data.messages);
channel.messages = data.messages.concat(channel.messages);
await nextTick();
channel.historyLoading = false;

View file

@ -299,7 +299,7 @@ class Chan {
return;
}
this.messages.unshift(...messages);
this.messages = messages.concat(this.messages);
if (!this.firstUnread) {
this.firstUnread = messages[messages.length - 1].id;