feat: Prevent duplicate message processing in Nostr chat
- Add logic to track processed message IDs, ensuring that messages are not processed multiple times, which enhances the reliability of message handling in the chat component.
This commit is contained in:
parent
55e051146e
commit
0e40b62466
1 changed files with 3 additions and 0 deletions
|
|
@ -417,6 +417,9 @@ export function useNostrChat() {
|
||||||
pubkey: currentUser.value.pubkey
|
pubkey: currentUser.value.pubkey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add to processed IDs to prevent duplicate processing
|
||||||
|
processedMessageIds.value.add(event.id)
|
||||||
|
|
||||||
if (!messages.value.has(peerPubkey)) {
|
if (!messages.value.has(peerPubkey)) {
|
||||||
messages.value.set(peerPubkey, [])
|
messages.value.set(peerPubkey, [])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue