File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
plugins/woocommerce-admin/client/inbox-panel Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ const InboxPanel = ( { showHeader = true } ) => {
207207 ) ;
208208 const [ allNotesFetched , setAllNotesFetched ] = useState ( false ) ;
209209 const [ allNotes , setAllNotes ] = useState ( [ ] ) ;
210+ const [ viewedNotes , setViewedNotes ] = useState ( { } ) ;
210211 const { createNotice } = useDispatch ( 'core/notices' ) ;
211212 const {
212213 removeNote,
@@ -241,7 +242,6 @@ const InboxPanel = ( { showHeader = true } ) => {
241242 notes : getNotes ( inboxQuery ) ,
242243 unreadNotesCount : getNotes ( {
243244 ...DEFAULT_INBOX_QUERY ,
244- _fields : [ 'id' ] ,
245245 is_read : false ,
246246 per_page : - 1 ,
247247 } ) . length ,
@@ -287,10 +287,13 @@ const InboxPanel = ( { showHeader = true } ) => {
287287 const [ showDismissAllModal , setShowDismissAllModal ] = useState ( false ) ;
288288
289289 const onNoteVisible = ( note ) => {
290- if ( ! note . is_read ) {
291- updateNote ( note . id , {
292- is_read : true ,
293- } ) ;
290+ if ( ! viewedNotes [ note . id ] && ! note . is_read ) {
291+ setViewedNotes ( { ...viewedNotes , [ note . id ] : true } ) ;
292+ setTimeout ( ( ) => {
293+ updateNote ( note . id , {
294+ is_read : true ,
295+ } ) ;
296+ } , 3000 ) ;
294297 }
295298 recordEvent ( 'inbox_note_view' , {
296299 note_content : note . content ,
You can’t perform that action at this time.
0 commit comments