Because the indexer processes Notes in bulk and after the fact, it could be the case where a new draft and a deletion event happen one after the other. If we don't re-check for deletions, the app will reindex the old draft that was already deleted by the LocalCache, creating a memory leak.

This commit is contained in:
Vitor Pamplona
2025-08-19 18:54:28 -04:00
parent 5662eda54c
commit 64f46a55f9
@@ -199,7 +199,7 @@ class DraftEventHandler(
eventNote: Note,
publicNote: Note,
) {
if (event.pubKey == account.signer.pubKey && !event.isDeleted()) {
if (event.pubKey == account.signer.pubKey && !event.isDeleted() && !LocalCache.deletionIndex.hasBeenDeleted(event)) {
val rumor = account.draftsDecryptionCache.preCachedDraft(event) ?: account.draftsDecryptionCache.cachedDraft(event)
rumor?.let { indexDraftAsRealEvent(eventNote, it) }
}