@@ -23,15 +23,13 @@ import {
2323} from '../utils/notifications/notifications' ;
2424import { removeNotifications } from '../utils/notifications/remove' ;
2525
26- // Apply optimistic local updates for read state when delayNotificationState is enabled
27- function applyLocalOptimisticRead (
28- state : GitifyState ,
29- targetNotifications : Notification [ ] ,
30- ) {
31- if ( state . settings . delayNotificationState ) {
32- for ( const n of targetNotifications ) {
33- n . unread = false ;
34- }
26+ /**
27+ * Apply optimistic local updates for read state. This helps with some
28+ * rendering edge cases between fetch notification intervals.
29+ */
30+ function markNotificationsAsReadLocally ( targetNotifications : Notification [ ] ) {
31+ for ( const n of targetNotifications ) {
32+ n . unread = false ;
3533 }
3634}
3735
@@ -137,7 +135,7 @@ export const useNotifications = (): NotificationsState => {
137135 notifications ,
138136 ) ;
139137
140- applyLocalOptimisticRead ( state , readNotifications ) ;
138+ markNotificationsAsReadLocally ( readNotifications ) ;
141139
142140 setNotifications ( updatedNotifications ) ;
143141 setTrayIconColor ( updatedNotifications ) ;
@@ -179,7 +177,7 @@ export const useNotifications = (): NotificationsState => {
179177 notifications ,
180178 ) ;
181179
182- applyLocalOptimisticRead ( state , doneNotifications ) ;
180+ markNotificationsAsReadLocally ( doneNotifications ) ;
183181
184182 setNotifications ( updatedNotifications ) ;
185183 setTrayIconColor ( updatedNotifications ) ;
0 commit comments