Conversation
…RScannerModal - Updated the camera permission request logic to ensure `onScanError` is only called after the permission request resolves with denial. - Added tests to verify that `onScanError` is not called when permission is granted or already available. - Enhanced cleanup logic in the effect to prevent state updates on unmounted components. This change improves the reliability of camera permission handling and enhances the user experience by preventing unnecessary error calls.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: The fix consolidates the logic into a single useEffect that properly awaits the requestPermission() promise and only calls onScanError if permission is actually denied. The AnimatedQRScannerModal component is used in:
SmokeAccounts is selected because it covers "adding QR-based hardware wallet accounts" which directly uses this component via ConnectQRHardware. While the component is also used in confirmations (QRSigningDetails, qr-info.tsx), the SmokeConfirmations tests focus on standard transaction/signature flows rather than QR hardware wallet signing specifically. The primary user-facing impact is in the QR hardware wallet connection flow covered by SmokeAccounts. This is a low-risk bug fix with good test coverage updates. The change is isolated to camera permission handling logic and doesn't modify the core QR scanning or signing functionality. Performance Test Selection: |
|
|
Tested on Android and iOS, the original issue is fixed. Adding the "qa passed" label. |



This PR fix #20442
This PR has improved camera permission handling in AnimatedQRScannerModal
onScanErroris only called after the permission request resolves with denial.onScanErroris not called when permission is granted or already available.This change improves the reliability of camera permission handling and enhances the user experience by preventing unnecessary error calls.
Description
Changelog
CHANGELOG entry: Improved camera permission handling in AnimatedQRScannerModal
Related issues
Fixes: #20442
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Small, localized change to permission-request side effects plus test updates; low risk aside from potential behavior change in when/if permission errors are surfaced.
Overview
Fixes camera permission error handling in
AnimatedQRScannerModalsoonScanErroris triggered only afterrequestPermission()resolves with a denial, and adds effect cleanup to avoid firing after unmount.Updates unit tests to assert
requestPermissionis called only when the modal is visible, and to cover the granted/already-granted paths whereonScanErrormust not fire.Written by Cursor Bugbot for commit 6dcc997. This will update automatically on new commits. Configure here.