diff --git a/src/libs/actions/IOU/index.ts b/src/libs/actions/IOU/index.ts index 14236f8a307a3..4e40bd6e858b0 100644 --- a/src/libs/actions/IOU/index.ts +++ b/src/libs/actions/IOU/index.ts @@ -13286,6 +13286,8 @@ type UpdateMultipleMoneyRequestsParams = { policyTags: OnyxCollection; hash?: number; allPolicies?: OnyxCollection; + introSelected: OnyxEntry; + betas: OnyxEntry; }; function updateMultipleMoneyRequests({ @@ -13299,6 +13301,8 @@ function updateMultipleMoneyRequests({ policyTags, hash, allPolicies, + introSelected, + betas, }: UpdateMultipleMoneyRequestsParams) { // Track running totals per report so multiple edits in the same report compound correctly. const optimisticReportsByID: Record = {}; @@ -13337,7 +13341,7 @@ function updateMultipleMoneyRequests({ // bulk-edit comments are visible immediately while still offline. let didCreateThreadInThisIteration = false; if (!transactionThreadReportID && iouReport?.reportID) { - const optimisticTransactionThread = createTransactionThreadReport(undefined, currentUserEmail, userAccountID, iouReport, reportAction, transaction); + const optimisticTransactionThread = createTransactionThreadReport(introSelected, currentUserEmail, userAccountID, betas, iouReport, reportAction, transaction); if (optimisticTransactionThread?.reportID) { transactionThreadReportID = optimisticTransactionThread.reportID; transactionThread = optimisticTransactionThread; diff --git a/src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx b/src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx index 7b977e78bc30b..7da8f8868a73d 100644 --- a/src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx +++ b/src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx @@ -40,6 +40,8 @@ function SearchEditMultiplePage() { const [allReportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); const [allPolicyTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS); const [allPolicyCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_CATEGORIES); + const [betas] = useOnyx(ONYXKEYS.BETAS); + const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const snapshotData = currentSearchResults?.data; const mergedTransactions = withSnapshotTransactions(allTransactions, snapshotData); @@ -165,6 +167,8 @@ function SearchEditMultiplePage() { policyTags: allPolicyTags, hash: currentSearchHash, allPolicies: policies, + introSelected, + betas, }); // Bulk edit can start from report (ID-based selection) or search (map-based selection), // so clear both stores to keep deselection behavior consistent. diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index 06e5f8753b07b..31584fbdc7893 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -12094,6 +12094,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); const params = writeSpy.mock.calls.at(0)?.[1] as {updates: string}; @@ -12163,6 +12165,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); expect(writeSpy).not.toHaveBeenCalled(); @@ -12221,6 +12225,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); const getOptimisticTotal = (callIndex: number) => { @@ -12288,6 +12294,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); const params = writeSpy.mock.calls.at(0)?.[1] as {updates: string}; @@ -12359,6 +12367,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); const params = writeSpy.mock.calls.at(0)?.[1] as {updates: string}; @@ -12421,6 +12431,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); const params = writeSpy.mock.calls.at(0)?.[1] as {updates: string}; @@ -12481,6 +12493,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); expect(writeSpy).toHaveBeenCalled(); @@ -12549,6 +12563,8 @@ describe('actions/IOU', () => { }, }, hash: undefined, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12601,6 +12617,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12656,6 +12674,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12718,6 +12738,8 @@ describe('actions/IOU', () => { }, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12781,6 +12803,8 @@ describe('actions/IOU', () => { allPolicies: { [`${ONYXKEYS.COLLECTION.POLICY}${transactionPolicyID}`]: transactionPolicy, }, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12855,6 +12879,8 @@ describe('actions/IOU', () => { allPolicies: { [`${ONYXKEYS.COLLECTION.POLICY}${transactionPolicyID}`]: txPolicy, }, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12917,6 +12943,8 @@ describe('actions/IOU', () => { }, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -12992,6 +13020,8 @@ describe('actions/IOU', () => { [`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policy.id}`]: policyTagsForPolicy, }, hash: undefined, + introSelected: undefined, + betas: undefined, }); await waitForBatchedUpdates(); @@ -13047,6 +13077,8 @@ describe('actions/IOU', () => { policyCategories: undefined, policyTags: {}, hash: undefined, + introSelected: undefined, + betas: undefined, }); // category/billable changes must be silently dropped for IOUs — @@ -13127,6 +13159,8 @@ describe('actions/IOU', () => { policyTags: {}, hash: undefined, allPolicies, + introSelected: undefined, + betas: undefined, }); // Then: the optimistic transaction update should use the transaction's own policy for tax resolution. @@ -13215,6 +13249,8 @@ describe('actions/IOU', () => { policyTags: {}, hash: undefined, allPolicies, + introSelected: undefined, + betas: undefined, }); // Then: buildOptimisticModifiedExpenseReportAction should receive the transaction's own policy,