From e8df0a39803b506666174301c33c8147744a6de9 Mon Sep 17 00:00:00 2001 From: rzuasti Date: Thu, 28 May 2026 09:26:14 -0400 Subject: [PATCH] Mark notification as read when navigating to device Tapping a notification row or selecting "View device" from the popup menu now marks the notification as read (if unread) before navigating to the device detail page. Co-Authored-By: Claude Sonnet 4.6 --- frontend/lib/notifications/notification_list.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/lib/notifications/notification_list.dart b/frontend/lib/notifications/notification_list.dart index cdf8e7d..6d591b8 100644 --- a/frontend/lib/notifications/notification_list.dart +++ b/frontend/lib/notifications/notification_list.dart @@ -211,7 +211,8 @@ class _NotificationListState extends State { icon: const Icon(Icons.more_vert), onSelected: (value) async { if (value == 'view_device') { - context.push('/devices/${item.macAddress}'); + if (item.isNew) await _markAsRead(context, item); + if (context.mounted) context.push('/devices/${item.macAddress}'); } else if (value == 'mark_read') { await _markAsRead(context, item); } else if (value == 'mark_new') { @@ -237,8 +238,10 @@ class _NotificationListState extends State { ], ), onTap: item.macAddress != null - ? () => - context.push('/devices/${item.macAddress}') + ? () async { + if (item.isNew) await _markAsRead(context, item); + if (context.mounted) context.push('/devices/${item.macAddress}'); + } : null, isThreeLine: true, ),