Skip to content

Commit

Permalink
Merge pull request #4078 from Expensify/ionatan_unneceesary_lastread
Browse files Browse the repository at this point in the history
Remove unnecessary calls to updateLastRead
  • Loading branch information
Clement DAL PALU authored Jul 15, 2021
2 parents 0735efc + c59f5ab commit 107b77f
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 107b77f

Please sign in to comment.