From 643f2514195ff4881d675946e511b9231bad9b6a Mon Sep 17 00:00:00 2001 From: hdbg Date: Sat, 28 Mar 2026 19:17:55 +0100 Subject: [PATCH] fix(useragent::dashboard): screen pushed twice due to improper listen hook --- useragent/lib/screens/server_connection.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/useragent/lib/screens/server_connection.dart b/useragent/lib/screens/server_connection.dart index 3a407cf..9f8e851 100644 --- a/useragent/lib/screens/server_connection.dart +++ b/useragent/lib/screens/server_connection.dart @@ -15,11 +15,11 @@ class ServerConnectionScreen extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final connectionState = ref.watch(connectionManagerProvider); - if (connectionState.value != null) { - WidgetsBinding.instance.addPostFrameCallback((_) { + ref.listen(connectionManagerProvider, (_, next) { + if (next.value != null && context.mounted) { context.router.replace(const VaultSetupRoute()); - }); - } + } + }); final body = switch (connectionState) { AsyncLoading() => const CircularProgressIndicator(),