Skip to content

Commit cd09dc9

Browse files
authored
Merge pull request #23653 from Expensify/yuwen-clientPolicyIDToLastModified
Send the clientPolicyIDToLastModified in addition to the policyIDList
2 parents 96c765d + 03f85c7 commit cd09dc9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/libs/actions/App.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ function getNonOptimisticPolicyIDs(policies) {
6363
.value();
6464
}
6565

66+
/**
67+
* @param {Array} policies
68+
* @return {Object} map of policy id to lastUpdated
69+
*/
70+
function getNonOptimisticPolicyIDToLastModifiedMap(policies) {
71+
return _.chain(policies)
72+
.reject((policy) => lodashGet(policy, 'pendingAction', '') === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD)
73+
.map((policy) => [policy.id, policy.lastModified || 0])
74+
.object()
75+
.value();
76+
}
77+
6678
/**
6779
* @param {String} locale
6880
*/
@@ -136,7 +148,7 @@ function openApp(isReconnecting = false) {
136148
//
137149
// - Look through the local report actions and reports to find the most recently modified report action or report.
138150
// - We send this to the server so that it can compute which new chats the user needs to see and return only those as an optimization.
139-
const params = {policyIDList: getNonOptimisticPolicyIDs(policies)};
151+
const params = {policyIDList: getNonOptimisticPolicyIDs(policies), policyIDToLastModified: JSON.stringify(getNonOptimisticPolicyIDToLastModifiedMap(policies))};
140152
if (isReconnecting) {
141153
Timing.start(CONST.TIMING.CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION);
142154
params.mostRecentReportActionLastModified = ReportActionsUtils.getMostRecentReportActionLastModified();

0 commit comments

Comments
 (0)