fix: close the building dialog once on cancel
What changed, and why it matters
This commit fixes a small UI bug in a cryptocurrency wallet app. Previously, pressing Cancel on a 'building transaction' dialog could close the dialog twice, which might cause a harmless crash or visual glitch. The fix moves the dialog-closing action into the cancel callback so it happens exactly once.
No security action required; treat as a routine UI bug fix.
Security signals we found
UI state/routing consistency fix
No cryptographic, authentication, or data-handling changes observed
Evidence from the diff
The patch removes two Navigator.of(context).pop() calls from inside the BuildingTransactionDialog widget and adds a single Navigator.of(context).pop() to the onCancel callback in step_4_view.dart. This ensures the dialog is popped exactly once when the user cancels, avoiding a potential double-pop that could throw a Navigator error or leave the route stack in an inconsistent state.
Changed components
lib/pages/exchange_view/exchange_step_views/step_4_view.dartlib/pages/send_view/sub_widgets/building_transaction_dialog.dartInspect captured patch +1 / −2
### lib/pages/exchange_view/exchange_step_views/step_4_view.dart
@@ -286,6 +286,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
isSpark: wallet is FiroWallet && !firoPublicSend,
onCancel: () {
wasCancelled = true;
+ Navigator.of(context).pop();
},
);
},
### lib/pages/send_view/sub_widgets/building_transaction_dialog.dart
@@ -115,7 +115,6 @@ class _RestoringDialogState extends ConsumerState<BuildingTransactionDialog> {
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
- Navigator.of(context).pop();
onCancel.call();
},
),
@@ -140,7 +139,6 @@ class _RestoringDialogState extends ConsumerState<BuildingTransactionDialog> {
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
- Navigator.of(context).pop();
onCancel.call();
},
),Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.