Skip to content

[Bug]:Badge-unlock toast fires multiple times when onSnapshot delivers rapid consecutive updates #635

Description

@Priyanka0205-CSE

Bug Description

Badge unlock toasts are triggered inside the onSnapshot listener on the user doc. When Firestore batches multiple field updates close together (e.g. a streak update and a points update landing within the same second), the listener fires more than once before the previous toast has dismissed, and the "badge earned" toast for the same badge shows up 2-3 times in a row. There's no dedupe check against badges already shown this session.

Steps to reproduce:

  1. Earn a badge right after a streak check-in (both writes tend to batch together)
  2. Watch the toast stack — the same badge toast appears more than once

Expected behavior:
Each badge should show exactly one toast per unlock, regardless of how many snapshot events fire for the same underlying change.

Metadata

Metadata

Labels

NSoC'26NSoC 2026backendBackend/Firebase related changesbugSomething isn't workingdocumentationImprovements or additions to documentationneeds-reviewIssue needs reviewneeds-triagensocNSoC

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions