From 228371e2713cdd33650bb843455be643f6e12b1f Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 13 Jul 2026 12:57:20 +1000 Subject: [PATCH] Fix multi dialog issues (#857) --- lib/widget/dialogs.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/widget/dialogs.dart b/lib/widget/dialogs.dart index 61da23e9..0c084095 100644 --- a/lib/widget/dialogs.dart +++ b/lib/widget/dialogs.dart @@ -224,6 +224,11 @@ Widget _buildErrorContent(String description, APIResponse? response) { ); } +// Track whether an error dialog is currently being displayed, +// so that we do not stack multiple error dialogs on top of each other +// (e.g. when several API requests fail in quick succession on startup) +bool _errorDialogVisible = false; + /* * Construct an error dialog showing information to the user * @@ -243,6 +248,13 @@ Future showErrorDialog( return; } + // Do not show a new error dialog if one is already visible + if (_errorDialogVisible) { + return; + } + + _errorDialogVisible = true; + final Color dialogColor = color ?? COLOR_DANGER; OneContext() @@ -263,6 +275,7 @@ Future showErrorDialog( ), ) .then((value) { + _errorDialogVisible = false; if (onDismissed != null) { onDismissed(); }