fix(android): delegate fetchProducts type 'all' to native query on Android - #239
Conversation
…droid The Android bridge expanded ProductQueryType.All into separate in-app and subs queries and merged them with putIfAbsent. Since openiap-google 2.4.x, each per-type query returns a not-found placeholder row for every requested sku of the other type, so the in-app placeholder shadowed the real subscription and subscriptions came back as type 'in-app' with productStatusAndroid 'not-found'. Pass the query type through unchanged so the native module resolves 'all' itself and each sku keeps its real product type and status. Closes #238 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154xivm4YeCVS9yxk54bHL6
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAndroid ChangesAndroid product fetching
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 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 |
There was a problem hiding this comment.
Code Review
This pull request simplifies product fetching in the React Native IAP Android library by passing the queryType directly to the native module, allowing it to resolve ProductQueryType.All natively. This change ensures SKUs retain their correct product types and eliminates the need for the collectAllQueryProducts helper function and its associated unit tests, which have been removed. I have no feedback to provide as there are no review comments to assess.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Documents the Android fetchProducts type 'all' fix (issue #238, PR #239) as an assumed-published 15.5.4 release entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154xivm4YeCVS9yxk54bHL6
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@libraries/react-native-iap/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt`:
- Around line 418-420: Update the result-building logic in HybridRnIap around
fetched, byId, and skusList to deduplicate requested IDs while preserving their
input order, then append fetched products not requested by skusList in
native-return order. Match the iOS result shape and run bun audit:parity after
making the platform-parity change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 36dcdd30-3ac0-4a8f-bda9-0e19a062b99e
📒 Files selected for processing (3)
libraries/react-native-iap/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.ktlibraries/react-native-iap/android/src/main/java/com/margelo/nitro/iap/ProductQueryHelpers.ktlibraries/react-native-iap/android/src/test/java/com/margelo/nitro/iap/ProductQueryHelpersTest.kt
💤 Files with no reviewable changes (2)
- libraries/react-native-iap/android/src/main/java/com/margelo/nitro/iap/ProductQueryHelpers.kt
- libraries/react-native-iap/android/src/test/java/com/margelo/nitro/iap/ProductQueryHelpersTest.kt
Deduplicate repeated skus and append fetched products that were not requested, mirroring the iOS bridge (PR #239 review). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154xivm4YeCVS9yxk54bHL6
Summary
fetchProducts({ type: 'all' })on Android returning subscriptions asin-appwithproductStatusAndroid: 'not-found'.allinto separate in-app and subs queries and merged them withputIfAbsent. Since openiap-google 2.4.x, each per-type query returns a not-found placeholder row for every requested sku of the other type, so the in-app placeholder shadowed the real subscription from the subs query.ProductQueryType.Allitself (all three store flavors — play/horizon/amazon — already handle it correctly, matching each sku as in-app first, then subs, then a typed unavailable placeholder). This also stops theproductTypeBySkucache from being poisoned within-appfor subscription skus, which previously broke subsequentrequestPurchasetype hints.collectAllQueryProductshelper and its tests (one test baked the buggy first-match-wins semantics in as expected behavior).packages/docsdocumenting the fix as the react-native-iap 15.5.4 release (assumed-published mode; the release-tag link goes live once 15.5.4 is deployed).allto the native layer and are unaffected.Closes #238
Test plan
yarn typecheckpasses (react-native-iap)yarn lintpasses (react-native-iap)bunx prettier --check,bun run build,bun run audit:docs,git diff --checkpass (packages/docs)🤖 Generated with Claude Code
https://claude.ai/code/session_0154xivm4YeCVS9yxk54bHL6
Summary by CodeRabbit
fetchProducts({ type: 'all' })behavior to fetch products more consistently and align closer to native handling.react-native-iap 15.5.4release note describing the AndroidfetchProducts({ type: 'all' })fix and updated the package release links.