Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send the clientPolicyIDToLastModified in addition to the policyIDList #23653

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ function getNonOptimisticPolicyIDs(policies) {
.value();
}

/**
* @param {Array} policies
* @return {Object} map of policy id to lastUpdated
*/
function getNonOptimisticPolicyIDToLastModifiedMap(policies) {
return _.chain(policies)
.reject((policy) => lodashGet(policy, 'pendingAction', null) === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD)
MonilBhavsar marked this conversation as resolved.
Show resolved Hide resolved
.map((policy) => [policy.id, policy.lastModified || 0])
.object()
.value();
}

/**
* @param {String} locale
*/
Expand Down Expand Up @@ -136,7 +148,7 @@ function openApp(isReconnecting = false) {
//
// - Look through the local report actions and reports to find the most recently modified report action or report.
// - 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.
const params = {policyIDList: getNonOptimisticPolicyIDs(policies)};
const params = {policyIDList: getNonOptimisticPolicyIDs(policies), policyIDToLastModified: JSON.stringify(getNonOptimisticPolicyIDToLastModifiedMap(policies))};
if (isReconnecting) {
Timing.start(CONST.TIMING.CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION);
params.mostRecentReportActionLastModified = ReportActionsUtils.getMostRecentReportActionLastModified();
Expand Down