Skip to content

Commit

Permalink
Merge pull request #24467 from Expensify/yuwen-backToPolicyList
Browse files Browse the repository at this point in the history
Revert back to using policyIDList instead of the last modified map when reconnecting the App
  • Loading branch information
luacmartins authored Aug 14, 2023
2 parents 6a5b1a4 + 7be2059 commit 21d483c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ function confirmReadyToOpenApp() {

/**
* @param {Array} policies
* @return {Object} map of policy id to lastUpdated
* @return {Array<String>} array of policy ids
*/
function getNonOptimisticPolicyIDToLastModifiedMap(policies) {
function getNonOptimisticPolicyIDs(policies) {
return _.chain(policies)
.reject((policy) => lodashGet(policy, 'pendingAction', '') === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD)
.map((policy) => [policy.id, policy.lastModified || 0])
.object()
.reject((policy) => lodashGet(policy, 'pendingAction', null) === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD)
.pluck('id')
.compact()
.value();
}

Expand Down Expand Up @@ -133,7 +133,7 @@ function getPolicyParamsForOpenOrReconnect() {
waitForCollectionCallback: true,
callback: (policies) => {
Onyx.disconnect(connectionID);
resolve({policyIDToLastModified: JSON.stringify(getNonOptimisticPolicyIDToLastModifiedMap(policies))});
resolve({policyIDList: getNonOptimisticPolicyIDs(policies)});
},
});
});
Expand Down

0 comments on commit 21d483c

Please sign in to comment.