mirror of https://github.com/buster-so/buster.git
Fix chat message ordering bug in handleExistingChat
- Prepend new message instead of appending to maintain descending order - Fixes BUS-1486: Message order reversal when adding follow-up messages - getMessagesForChat returns newest-first, so new messages should be prepended Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
This commit is contained in:
parent
a6f8e041cd
commit
2ecf0a05fb
|
@ -257,8 +257,8 @@ export async function handleExistingChat(
|
||||||
getMessagesForChat(chatId),
|
getMessagesForChat(chatId),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Combine messages
|
// Combine messages - prepend new message to maintain descending order (newest first)
|
||||||
const allMessages = newMessage ? [...existingMessages, newMessage] : existingMessages;
|
const allMessages = newMessage ? [newMessage, ...existingMessages] : existingMessages;
|
||||||
|
|
||||||
// Build chat with messages
|
// Build chat with messages
|
||||||
const chatWithMessages: ChatWithMessages = buildChatWithMessages(
|
const chatWithMessages: ChatWithMessages = buildChatWithMessages(
|
||||||
|
|
Loading…
Reference in New Issue