Skip to content

fix: deduplicate repost counts#40

Merged
barrydeen merged 1 commit intomainfrom
fix/repost-double-counting
Feb 26, 2026
Merged

fix: deduplicate repost counts#40
barrydeen merged 1 commit intomainfrom
fix/repost-double-counting

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • Repost count immediately showed 2 after reposting a note because both markUserRepost() (optimistic update) and the kind 6 handler in addEvent() independently incremented a separate repostCounts counter
  • Removed the redundant repostCounts LruCache and now derive counts from repostAuthors set size, which naturally deduplicates by pubkey

Test plan

  • Repost a note and verify count shows 1, not 2
  • Verify repost counts from other users still aggregate correctly
  • Verify repost counts persist correctly after scrolling away and back

markUserRepost() and the kind 6 handler in addEvent() both incremented
a separate repostCounts counter, causing reposts to immediately show
a count of 2. Remove the redundant counter and derive counts from the
repostAuthors set, which naturally deduplicates by pubkey.
@barrydeen barrydeen merged commit eb416e4 into main Feb 26, 2026
@barrydeen barrydeen deleted the fix/repost-double-counting branch March 4, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant