fix: transaction json handling and parsing#442
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFixes an iOS crash when viewing payment notification details caused by double URL-encoding. ChangesDeep-link encoding fix and Transaction screen refactor
Sequence Diagram(s)sequenceDiagram
participant iOS as iOS NotificationService
participant handleLink as handleLink
participant Transaction as Transaction()
participant Router as expo-router
iOS->>iOS: NSURLComponents.queryItems = [{transaction, app_pubkey}]
iOS->>iOS: deepLink = components.URL (properly encoded, no double-encode)
iOS->>handleLink: alby://payment_notification?transaction=...&app_pubkey=...
handleLink->>handleLink: URLSearchParams.get("transaction") — raw, no decodeURIComponent
handleLink->>Router: push("/transaction", { transactionJSON, appPubkey })
Router->>Transaction: mount with route params
Transaction->>Transaction: useMemo → JSON.parse(transactionJSON) with try/catch
alt parse failure
Transaction->>Router: replace("/") + errorToast
else parse success
Transaction->>Transaction: render TransactionSummary + TransactionDetails
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
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 `@pages/Transaction.tsx`:
- Around line 83-87: The useEffect hook that calls
useAppStore.getState().setSelectedWallet(appPubkey) currently updates the wallet
whenever appPubkey changes, regardless of whether the transaction payload is
valid. Add a condition to check that the transaction has been successfully
parsed and is valid before executing the setSelectedWallet call. This ensures
that a malformed deep-link cannot change the wallet context before the redirect
happens. Include a check for transaction validation status in the conditional
logic alongside the appPubkey check.
🪄 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: 69c286b4-d591-4a6c-96ff-99a31e13f2de
📒 Files selected for processing (4)
assets/ios/NotificationService.mhooks/__tests__/useHandleLinking.tslib/link.tspages/Transaction.tsx
Fixes #433
Summary by CodeRabbit