File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Packages/Notifications/Sources/Notifications/List Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -70,23 +70,15 @@ public struct NotificationsListView: View {
7070 if lockedType == nil && lockedAccountId == nil {
7171 ToolbarTitleMenu {
7272 Button {
73- selectedType = nil
74- Task {
75- viewState = . loading
76- await fetchNotifications ( )
77- }
73+ applyFilter ( type: nil )
7874 } label: {
7975 Label ( " notifications.navigation-title " , systemImage: " bell.fill " )
8076 . tint ( theme. labelColor)
8177 }
8278 Divider ( )
8379 ForEach ( Notification . NotificationType. allCases, id: \. self) { type in
8480 Button {
85- selectedType = type
86- Task {
87- viewState = . loading
88- await fetchNotifications ( )
89- }
81+ applyFilter ( type: type)
9082 } label: {
9183 Label {
9284 Text ( type. menuTitle ( ) )
@@ -277,6 +269,16 @@ public struct NotificationsListView: View {
277269}
278270
279271extension NotificationsListView {
272+ private func applyFilter( type: Models . Notification . NotificationType ? ) {
273+ selectedType = type
274+ dataSource. reset ( )
275+ viewState = . loading
276+
277+ Task {
278+ await fetchNotifications ( )
279+ }
280+ }
281+
280282 private func fetchNotifications( ) async {
281283 do {
282284 let result = try await dataSource. fetchNotifications (
You can’t perform that action at this time.
0 commit comments