From 04808f8b5cd9fa3f4a8815adb3aa0323bce31e90 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 11 Jun 2024 05:48:49 -0500 Subject: [PATCH] fix(mobile): warning message not resetting when changing server URL (#10112) --- mobile/lib/widgets/forms/login/login_form.dart | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mobile/lib/widgets/forms/login/login_form.dart b/mobile/lib/widgets/forms/login/login_form.dart index 4504860d44..0395bdcb28 100644 --- a/mobile/lib/widgets/forms/login/login_form.dart +++ b/mobile/lib/widgets/forms/login/login_form.dart @@ -54,7 +54,7 @@ class LoginForm extends HookConsumerWidget { duration: const Duration(seconds: 60), )..repeat(); final serverInfo = ref.watch(serverInfoProvider); - final warningMessage = useState(''); + final warningMessage = useState(null); final ValueNotifier serverEndpoint = useState(null); @@ -67,16 +67,12 @@ class LoginForm extends HookConsumerWidget { final serverMajorVersion = serverInfo.serverVersion.major; final serverMinorVersion = serverInfo.serverVersion.minor; - final message = getVersionCompatibilityMessage( + warningMessage.value = getVersionCompatibilityMessage( appMajorVersion, appMinorVersion, serverMajorVersion, serverMinorVersion, ); - - if (message != null) { - warningMessage.value = message; - } } catch (error) { warningMessage.value = 'Error checking version compatibility'; } @@ -345,7 +341,7 @@ class LoginForm extends HookConsumerWidget { buildVersionCompatWarning() { checkVersionMismatch(); - if (warningMessage.value.isEmpty) { + if (warningMessage.value == null) { return const SizedBox.shrink(); } @@ -363,7 +359,7 @@ class LoginForm extends HookConsumerWidget { ), ), child: Text( - warningMessage.value, + warningMessage.value!, textAlign: TextAlign.center, ), ),