Skip to content

Commit

Permalink
Simplify conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Mar 28, 2024
1 parent e4a1305 commit be315d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,11 @@ function openReport(
{optimisticData, successData, failureData},
{
getConflictingRequests: (persistedRequests) =>
persistedRequests.filter(
(request) => request.command === WRITE_COMMANDS.OPEN_REPORT && request.data?.reportID === reportID && !isCreatingNewReport && !request.data?.createdReportActionID,
),
// requests conflict only if:
// 1. they are OpenReport commands
// 2. they have the same reportID
// 3. they are not creating a report - all calls to OpenReport that create a report will be unique and have a unique createdReportActionID
persistedRequests.filter((request) => request.command === WRITE_COMMANDS.OPEN_REPORT && request.data?.reportID === reportID && !request.data?.createdReportActionID),
},
);
}
Expand Down

0 comments on commit be315d6

Please sign in to comment.