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:
- Earn a badge right after a streak check-in (both writes tend to batch together)
- 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.
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:
Expected behavior:
Each badge should show exactly one toast per unlock, regardless of how many snapshot events fire for the same underlying change.