From f6bf73c4f614ef0ac88714c3e4da550b7e8e22a9 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 14 Oct 2025 09:24:22 +0200 Subject: [PATCH] Fix notifications filter reset --- .../List/NotificationsListView.swift | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Packages/Notifications/Sources/Notifications/List/NotificationsListView.swift b/Packages/Notifications/Sources/Notifications/List/NotificationsListView.swift index a57fa27d9..eb1e57c5f 100644 --- a/Packages/Notifications/Sources/Notifications/List/NotificationsListView.swift +++ b/Packages/Notifications/Sources/Notifications/List/NotificationsListView.swift @@ -70,11 +70,7 @@ public struct NotificationsListView: View { if lockedType == nil && lockedAccountId == nil { ToolbarTitleMenu { Button { - selectedType = nil - Task { - viewState = .loading - await fetchNotifications() - } + applyFilter(type: nil) } label: { Label("notifications.navigation-title", systemImage: "bell.fill") .tint(theme.labelColor) @@ -82,11 +78,7 @@ public struct NotificationsListView: View { Divider() ForEach(Notification.NotificationType.allCases, id: \.self) { type in Button { - selectedType = type - Task { - viewState = .loading - await fetchNotifications() - } + applyFilter(type: type) } label: { Label { Text(type.menuTitle()) @@ -277,6 +269,16 @@ public struct NotificationsListView: View { } extension NotificationsListView { + private func applyFilter(type: Models.Notification.NotificationType?) { + selectedType = type + dataSource.reset() + viewState = .loading + + Task { + await fetchNotifications() + } + } + private func fetchNotifications() async { do { let result = try await dataSource.fetchNotifications(