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.
This commit is contained in:
parent
de918419fa
commit
22b3c430fa
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue