fix(expo): prevent duplicate purchase requests - #451
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe purchase flow now blocks concurrent purchase requests with a pending-state guard. The guard clears after resolution or rejection. A test covers rapid presses, cancellation, and a subsequent purchase. ChangesPurchase request concurrency
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The purchase guard blocks overlapping requests and is released after cancellation or other failures, so the change is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #451 +/- ##
=======================================
Coverage 76.16% 76.16%
=======================================
Files 157 157
Lines 16676 16676
Branches 4807 4807
=======================================
Hits 12702 12702
Misses 3974 3974
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Available on main in 32c8e58. All PR checks passed. This example-only fix does not require a package release. |
Repeated presses could start two native purchases before React disabled the Expo example's Purchase button. Keep one request pending at a time and allow another after it settles. A regression test invokes the same render's handler twice and checks that cancellation allows retry.
Checks: Expo lint and TypeScript passed; 454 library, 82 plugin, and 141 example tests passed. Pre-commit parity, layout, sponsor, and IAPKit contract audits passed.
Device evidence: iPhone 13 mini and Pixel 2 completed real Apple Sandbox and Google Play test purchases through the local IAPKit server and DEV Convex. Each created one purchase row; replay kept the same row and total. After the fix, Pixel 2 keyboard input produced one native request, zero overlapping-request errors, and successful cancellation with the button enabled again. The iPhone purchase preceded this JavaScript guard; no native code changed.
The change only affects the example's request guard. These results do not establish a live subscription-webhook integration with the separate Commerce example or an external product. Existing Commerce fixture evidence remains scoped as documented.
Summary by CodeRabbit