Skip to content

Commit

Permalink
Remove unnecessary calls to updateLastRead
Browse files Browse the repository at this point in the history
  • Loading branch information
iwiznia committed Jul 15, 2021
1 parent 1a1d66a commit c59f5ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,11 @@ function updateLastReadActionID(reportID, sequenceNumber) {
// action). If 1 isn't subtracted then the "New" marker appears one row below the action (the first unread action)
const lastReadSequenceNumber = (sequenceNumber - 1) || reportMaxSequenceNumbers[reportID];

// We call this method in many cases where there's nothing to update because we already updated it, so we avoid
// doing an unnecessary server call if the last read is the same one we had already
if (lastReadSequenceNumbers[reportID] === lastReadSequenceNumber) {
return;
}
setLocalLastRead(reportID, lastReadSequenceNumber);

// Mark the report as not having any unread items
Expand Down

0 comments on commit c59f5ab

Please sign in to comment.