Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 793 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -923,7 +923,7 @@
};

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 926 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -937,7 +937,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 940 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -946,7 +946,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 949 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -960,7 +960,7 @@
});

let allPolicyTags: OnyxCollection<OnyxTypes.PolicyTagLists> = {};
Onyx.connect({

Check warning on line 963 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_TAGS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -973,7 +973,7 @@
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 976 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -982,7 +982,7 @@
});

let allReportNameValuePairs: OnyxCollection<OnyxTypes.ReportNameValuePairs>;
Onyx.connect({

Check warning on line 985 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -992,7 +992,7 @@

let userAccountID = -1;
let currentUserEmail = '';
Onyx.connect({

Check warning on line 995 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
currentUserEmail = value?.email ?? '';
Expand All @@ -1001,7 +1001,7 @@
});

let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>;
Onyx.connect({

Check warning on line 1004 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
deprecatedCurrentUserPersonalDetails = value?.[userAccountID] ?? undefined;
Expand All @@ -1009,7 +1009,7 @@
});

let allReportActions: OnyxCollection<OnyxTypes.ReportActions>;
Onyx.connect({

Check warning on line 1012 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -13286,6 +13286,8 @@
policyTags: OnyxCollection<OnyxTypes.PolicyTagLists>;
hash?: number;
allPolicies?: OnyxCollection<OnyxTypes.Policy>;
introSelected: OnyxEntry<OnyxTypes.IntroSelected>;
betas: OnyxEntry<OnyxTypes.Beta[]>;
};

function updateMultipleMoneyRequests({
Expand All @@ -13299,6 +13301,8 @@
policyTags,
hash,
allPolicies,
introSelected,
betas,
}: UpdateMultipleMoneyRequestsParams) {
// Track running totals per report so multiple edits in the same report compound correctly.
const optimisticReportsByID: Record<string, OnyxTypes.Report> = {};
Expand Down Expand Up @@ -13337,7 +13341,7 @@
// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
36 changes: 36 additions & 0 deletions tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -12163,6 +12165,8 @@ describe('actions/IOU', () => {
policyCategories: undefined,
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});

expect(writeSpy).not.toHaveBeenCalled();
Expand Down Expand Up @@ -12221,6 +12225,8 @@ describe('actions/IOU', () => {
policyCategories: undefined,
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});

const getOptimisticTotal = (callIndex: number) => {
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -12481,6 +12493,8 @@ describe('actions/IOU', () => {
policyCategories: undefined,
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});

expect(writeSpy).toHaveBeenCalled();
Expand Down Expand Up @@ -12549,6 +12563,8 @@ describe('actions/IOU', () => {
},
},
hash: undefined,
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12601,6 +12617,8 @@ describe('actions/IOU', () => {
policyCategories: undefined,
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12656,6 +12674,8 @@ describe('actions/IOU', () => {
policyCategories: undefined,
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12718,6 +12738,8 @@ describe('actions/IOU', () => {
},
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12781,6 +12803,8 @@ describe('actions/IOU', () => {
allPolicies: {
[`${ONYXKEYS.COLLECTION.POLICY}${transactionPolicyID}`]: transactionPolicy,
},
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12855,6 +12879,8 @@ describe('actions/IOU', () => {
allPolicies: {
[`${ONYXKEYS.COLLECTION.POLICY}${transactionPolicyID}`]: txPolicy,
},
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12917,6 +12943,8 @@ describe('actions/IOU', () => {
},
policyTags: {},
hash: undefined,
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -12992,6 +13020,8 @@ describe('actions/IOU', () => {
[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policy.id}`]: policyTagsForPolicy,
},
hash: undefined,
introSelected: undefined,
betas: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -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 —
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -13215,6 +13249,8 @@ describe('actions/IOU', () => {
policyTags: {},
hash: undefined,
allPolicies,
introSelected: undefined,
betas: undefined,
});

// Then: buildOptimisticModifiedExpenseReportAction should receive the transaction's own policy,
Expand Down
Loading