Skip to content

fix: stale hubCoins in transaction and unhandled batch flush promise#649

Open
saurabhhhcodes wants to merge 2 commits into
indresh404:mainfrom
saurabhhhcodes:fix/rankerhub-batch-1
Open

fix: stale hubCoins in transaction and unhandled batch flush promise#649
saurabhhhcodes wants to merge 2 commits into
indresh404:mainfrom
saurabhhhcodes:fix/rankerhub-batch-1

Conversation

@saurabhhhcodes

Copy link
Copy Markdown

Bug 1: Stale hubCoins in streak transaction

In AuthContext.jsx checkAndUpdateStreak, the Firestore transaction reads latestData via transaction.get() but then uses data.hubCoins (the stale snapshot data from the listener) instead of latestData.hubCoins. This causes race conditions where concurrent updates to hubCoins are lost.

Fix: Use latestData.hubCoins from the transaction read.

Bug 2: Unhandled promise rejection in batch flush

In FirestoreBatchOptimizer.add(), this.flush() was called without await or .catch(), causing unhandled promise rejections when the batch commit fails.

Fix: Added .catch() to handle the rejected promise gracefully.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jul 24, 2026 8:14am

@github-actions github-actions Bot added backend Backend/Firebase related changes bug Something isn't working enhancement New feature or request nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend/Firebase related changes bug Something isn't working enhancement New feature or request nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant