Refresh device and notification lists on return navigation

Subscribes the devices list and notifications list to a shared
RouteObserver so they refetch when a pushed route (e.g. device detail)
is popped, avoiding stale state after registering or updating a device.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-05-29 15:13:00 -04:00
co-authored by Claude Opus 4.7
parent eb91804c97
commit 926a902377
3 changed files with 40 additions and 2 deletions
+6
View File
@@ -35,11 +35,17 @@ const List<_NavDest> _destinations = [
(icon: Icons.info_outline, activeIcon: Icons.info, label: 'About'),
];
// Observer used to notify subscribed routes when another route is pushed
// on top of or popped from them, so they can refresh stale data.
final RouteObserver<ModalRoute<void>> routeObserver =
RouteObserver<ModalRoute<void>>();
// Routes definitions
final GoRouter router = GoRouter(
initialLocation: '/notifications',
routes: [
ShellRoute(
observers: [routeObserver],
builder: (context, state, child) {
return MainShell(child: child);
},