This repository was archived by the owner on Oct 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/views/navbar/components Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -236,16 +236,16 @@ class NotificationsTab extends React.Component<Props, State> {
236236 const newNotifications =
237237 notifications &&
238238 notifications . map ( n => Object . assign ( { } , n , { isSeen : true } ) ) ;
239- this . processAndMarkSeenNotifications ( newNotifications ) ;
239+ this . processAndMarkSeenNotifications ( newNotifications , false ) ;
240240 // otherwise
241241 return markAllNotificationsSeen ( ) . catch ( err => {
242242 console . error ( err ) ;
243243 // Undo the optimistic update from above
244- this . processAndMarkSeenNotifications ( oldNotifications ) ;
244+ this . processAndMarkSeenNotifications ( oldNotifications , false ) ;
245245 } ) ;
246246 } ;
247247
248- processAndMarkSeenNotifications = stateNotifications => {
248+ processAndMarkSeenNotifications = ( stateNotifications , sync = true ) => {
249249 const {
250250 data : { notifications } ,
251251 location,
@@ -321,12 +321,14 @@ class NotificationsTab extends React.Component<Props, State> {
321321 } ) ;
322322
323323 // and then mark it as seen on the server
324- client . mutate ( {
325- mutation : markSingleNotificationSeenMutation ,
326- variables : {
327- id : n . id ,
328- } ,
329- } ) ;
324+ if ( sync ) {
325+ client . mutate ( {
326+ mutation : markSingleNotificationSeenMutation ,
327+ variables : {
328+ id : n . id ,
329+ } ,
330+ } ) ;
331+ }
330332
331333 return newNotification ;
332334 } else {
You can’t perform that action at this time.
0 commit comments