feat: use array replacement instead of for loop to add older messages to array
This commit is contained in:
parent
e8af398831
commit
a2b05ad68c
1 changed files with 4 additions and 10 deletions
|
@ -268,17 +268,11 @@ onMounted(async () => {
|
||||||
console.log("scroll height is at 10% or less");
|
console.log("scroll height is at 10% or less");
|
||||||
//console.log("current oldest:", currentOldestMessage);
|
//console.log("current oldest:", currentOldestMessage);
|
||||||
const olderMessages = await fetchMessages(route.params.channelId as string, { amount, offset });
|
const olderMessages = await fetchMessages(route.params.channelId as string, { amount, offset });
|
||||||
if (olderMessages) {
|
if (olderMessages?.length) {
|
||||||
olderMessages.reverse();
|
olderMessages.reverse();
|
||||||
console.log("older messages:", olderMessages);
|
messages.value = [...olderMessages.map(msg => reactive(msg)), ...messages.value];
|
||||||
if (olderMessages.length == 0) return;
|
for (const message of messages.value) {
|
||||||
olderMessages.reverse();
|
groupMessage(message);
|
||||||
for (const [i, oldMessage] of olderMessages.entries()) {
|
|
||||||
console.log("old message:", oldMessage);
|
|
||||||
messages.value.unshift(oldMessage);
|
|
||||||
for (const message of messages.value) {
|
|
||||||
groupMessage(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
offset += offset;
|
offset += offset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue