fix(shopinbit): show customer key generation errors as a dialog
What changed, and why it matters
This commit changes how an error message is shown to the user when key generation fails in a shopping-related settings screen. Instead of a temporary warning banner, it now shows a popup dialog. It also adds a safety check to avoid updating the screen after the user has navigated away. This is a minor UI/UX fix with no clear security impact.
No security action required; treat as routine UI fix.
Security signals we found
No security-relevant logic changed
UI-only error presentation change
Added mounted guard to prevent setState after unmount
Evidence from the diff
The patch replaces a floating flush bar (showFloatingFlushBar) with a modal dialog (StackOkDialog) for displaying customer key generation errors in shopinbit_settings_view.dart. It awaits the dialog and guards the subsequent setState call with if (mounted). This prevents calling setState on a disposed widget but does not alter key generation logic, cryptography, or error handling semantics.
Changed components
lib/pages/shopinbit/shopinbit_settings_view.dartInspect captured patch +11 / −6
diff --git a/lib/pages/shopinbit/shopinbit_settings_view.dart b/lib/pages/shopinbit/shopinbit_settings_view.dart
index 886ba4c..d9574f6 100644
--- a/lib/pages/shopinbit/shopinbit_settings_view.dart
+++ b/lib/pages/shopinbit/shopinbit_settings_view.dart
@@ -121,16 +121,21 @@ class _ShopInBitSettingsViewState extends ConsumerState<ShopInBitSettingsView> {
}
} catch (e) {
if (mounted) {
- unawaited(
- showFloatingFlushBar(
- type: FlushBarType.warning,
- message: "Failed to generate key: $e",
- context: context,
+ await showDialog<void>(
+ context: context,
+ useRootNavigator: Util.isDesktop,
+ builder: (context) => StackOkDialog(
+ title: "Failed to generate key",
+ maxWidth: Util.isDesktop ? 500 : null,
+ message: e.toString(),
+ desktopPopRootNavigator: Util.isDesktop,
),
);
}
} finally {
- setState(() => _loading = false);
+ // Awaiting the error dialog above means the widget can unmount before
+ // we get here.
+ if (mounted) setState(() => _loading = false);
}
}
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.