From fec33aa694b38a771291f46fa69d0daed7311909 Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Sun, 8 Feb 2026 17:37:34 +0100 Subject: [PATCH] fix rout state issue --- app/lib/core/providers/router.dart | 15 ++++++++------- app/lib/core/providers/router.g.dart | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/lib/core/providers/router.dart b/app/lib/core/providers/router.dart index ecc57322..4835d0db 100644 --- a/app/lib/core/providers/router.dart +++ b/app/lib/core/providers/router.dart @@ -60,23 +60,24 @@ class CurrentTopRoute extends _$CurrentTopRoute { final router = ref.watch(routerProvider).value; if (router == null) return null; - void update() { + GoRoute? getCurrentRoute() { final config = router.routerDelegate.currentConfiguration; if (config.isEmpty) { - state = null; - return; + return null; } final match = config.last; - state = match.route; + return match.route; + } + + void update() { + state = getCurrentRoute(); } router.routerDelegate.addListener(update); ref.onDispose(() => router.routerDelegate.removeListener(update)); - update(); - - return state; + return getCurrentRoute(); } } diff --git a/app/lib/core/providers/router.g.dart b/app/lib/core/providers/router.g.dart index c83954df..be3a5bca 100644 --- a/app/lib/core/providers/router.g.dart +++ b/app/lib/core/providers/router.g.dart @@ -75,7 +75,7 @@ final class CurrentTopRouteProvider } } -String _$currentTopRouteHash() => r'1d71db42203483c7d919f44879e673f2f36d2e6a'; +String _$currentTopRouteHash() => r'60bc1b11ab636ba250b891eed24f7e7dd8e62d81'; abstract class _$CurrentTopRoute extends $Notifier { RouteBase? build();