From 22b3c430fa5a4c503cc3c7a779978f7e61019c8a Mon Sep 17 00:00:00 2001 From: padreug Date: Sun, 10 Aug 2025 17:23:18 +0200 Subject: [PATCH] feat: Sort Nostr chat messages by timestamp for chronological display - Update the computed property in ChatComponent to sort messages by their creation timestamp, ensuring they are displayed in chronological order for better user experience. --- src/components/nostr/ChatComponent.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/nostr/ChatComponent.vue b/src/components/nostr/ChatComponent.vue index 7757778..e48cdd1 100644 --- a/src/components/nostr/ChatComponent.vue +++ b/src/components/nostr/ChatComponent.vue @@ -421,7 +421,10 @@ const { // Computed const currentMessages = computed(() => { if (!selectedPeer.value) return [] - return messages.value.get(selectedPeer.value.pubkey) || [] + const peerMessages = messages.value.get(selectedPeer.value.pubkey) || [] + + // Sort messages by timestamp (oldest first) to ensure chronological order + return [...peerMessages].sort((a, b) => a.created_at - b.created_at) }) // Sort peers by latest message timestamp (newest first) and unread status