fix(contacts): tell the user when a scanned QR carries no address [PERA-4746] - #1110
Draft
yasin-ce wants to merge 1 commit into
Draft
fix(contacts): tell the user when a scanned QR carries no address [PERA-4746]#1110yasin-ce wants to merge 1 commit into
yasin-ce wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Scanning a wrong-context QR into an address field (a WalletConnect code is the common one) closed the scanner and left the field empty with nothing said, so it was indistinguishable from a scan that never registered.
AddressEntryFieldandContactForm— so the rule now lives once inuseScannedAddress, and both adopt it.AddressSearchInputandWatchAccountScreeninherit it throughAddressEntryField.Related Issues
Checklist
Additional Notes
The dismiss has to happen before the toast, and that is the subtle part.
errorToastpasses no notifier, souseToastfalls back to the globalNotifier, which renders in the root tree — the treeuseQRScannerView's own docstring describes as obscured by the scanner's native Modal while it is open. Toasting first would schedule the notification behind the Modal and leave whether the user sees it up to dismiss-animation timing. Both callers now dismiss first, mirroringuseImportAccountScreen, and a test assertsisVisible === falseat the moment the resolver runs so the ordering can't regress silently.Why the hook sits in
@hooks/rather than besideAddressEntryField. It is shared by two components, and putting it under one of them meantContactFormdeep-importing past that component's barrel. KeepingextractAddressFromScannedUrlin the component file also created a real import cycle (component → hook → component), which is why the util moved with it. Its existing tests moved to the new spec, along with two new cases for the hook.An earlier revision of this branch toasted before dismissing and kept the hook inside the component folder; both were caught in review and are fixed here.