Skip to content

Commit

Permalink
Merge pull request Expensify#34236 from FitseTLT/fix-recent-tag-categ…
Browse files Browse the repository at this point in the history
…ory-split-receipt-request

Fix - no recently used tags and categories for startSplitBill issue
  • Loading branch information
thienlnam authored Jan 23, 2024
2 parents e159ec7 + 0f83a4e commit 95f2d48
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,32 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
});
});

_.each(participants, (participant) => {
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(participant);
if (!isPolicyExpenseChat) {
return;
}

const optimisticPolicyRecentlyUsedCategories = Policy.buildOptimisticPolicyRecentlyUsedCategories(participant.policyID, category);
const optimisticPolicyRecentlyUsedTags = Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag);

if (!_.isEmpty(optimisticPolicyRecentlyUsedCategories)) {
optimisticData.push({
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participant.policyID}`,
value: optimisticPolicyRecentlyUsedCategories,
});
}

if (!_.isEmpty(optimisticPolicyRecentlyUsedTags)) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${participant.policyID}`,
value: optimisticPolicyRecentlyUsedTags,
});
}
});

// Save the new splits array into the transaction's comment in case the user calls CompleteSplitBill while offline
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
Expand Down

0 comments on commit 95f2d48

Please sign in to comment.