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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"react-native-localize": "^3.5.4",
"react-native-nitro-modules": "0.29.4",
"react-native-nitro-sqlite": "9.1.11",
"react-native-onyx": "3.0.8",
"react-native-onyx": "3.0.13",
"react-native-pager-view": "6.9.1",
"react-native-pdf": "7.0.2",
"react-native-performance": "^5.1.4",
Expand Down
1 change: 1 addition & 0 deletions src/libs/Network/SequentialQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Onyx.connectWithoutView({
});

function saveQueueFlushedData(...onyxUpdates: OnyxUpdate[]) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
const newValue = [...queueFlushedDataToStore, ...onyxUpdates];
// eslint-disable-next-line rulesdir/prefer-actions-set-data
return Onyx.set(ONYXKEYS.QUEUE_FLUSHED_DATA, newValue).then(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/libs/OptimisticReportNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ function updateOptimisticReportNamesFromUpdates(updates: OnyxUpdate[], context:
const reportNameUpdate = computeReportNameIfNeeded(report, update, context);

if (reportNameUpdate) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
additionalUpdates.push({
key: getReportKey(reportID),
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -321,6 +322,7 @@ function updateOptimisticReportNamesFromUpdates(updates: OnyxUpdate[], context:
const reportNameUpdate = computeReportNameIfNeeded(report, update, context);

if (reportNameUpdate) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
additionalUpdates.push({
key: getReportKey(report.reportID),
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -346,6 +348,7 @@ function updateOptimisticReportNamesFromUpdates(updates: OnyxUpdate[], context:
const reportNameUpdate = computeReportNameIfNeeded(report, update, context);

if (reportNameUpdate) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
additionalUpdates.push({
key: getReportKey(report.reportID),
onyxMethod: Onyx.METHOD.MERGE,
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type IssueNewCardFlowData = {
function reportVirtualExpensifyCardFraud(card: Card, validateCode: string) {
const cardID = card?.cardID ?? CONST.DEFAULT_NUMBER_ID;
const optimisticData: OnyxUpdate[] = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.FORMS.REPORT_VIRTUAL_CARD_FRAUD,
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/CompanyCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function addNewCompanyCardsFeed(
const feedType = CardUtils.getFeedType(cardFeed, cardFeeds);

const optimisticData: OnyxUpdate[] = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`,
Expand Down Expand Up @@ -121,6 +122,7 @@ function addNewCompanyCardsFeed(
];

const successData: OnyxUpdate[] = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`,
Expand Down
25 changes: 25 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@
};

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

Check warning on line 719 in src/libs/actions/IOU.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 @@ -797,13 +797,13 @@
};

let allBetas: OnyxEntry<OnyxTypes.Beta[]>;
Onyx.connect({

Check warning on line 800 in src/libs/actions/IOU.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.BETAS,
callback: (value) => (allBetas = value),
});

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

Check warning on line 806 in src/libs/actions/IOU.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 @@ -817,7 +817,7 @@
});

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

Check warning on line 820 in src/libs/actions/IOU.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 @@ -826,7 +826,7 @@
});

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

Check warning on line 829 in src/libs/actions/IOU.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 @@ -840,7 +840,7 @@
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStep>> = {};
Onyx.connect({

Check warning on line 843 in src/libs/actions/IOU.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.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -849,7 +849,7 @@
});

const allPolicies: OnyxCollection<OnyxTypes.Policy> = {};
Onyx.connect({

Check warning on line 852 in src/libs/actions/IOU.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,
callback: (val, key) => {
if (!key) {
Expand Down Expand Up @@ -885,14 +885,14 @@
// `allRecentlyUsedTags` was moved here temporarily from `src/libs/actions/Policy/Tag.ts` during the `Deprecate Onyx.connect` refactor.
// All uses of this variable should be replaced with `useOnyx`.
let allRecentlyUsedTags: OnyxCollection<RecentlyUsedTags> = {};
Onyx.connect({

Check warning on line 888 in src/libs/actions/IOU.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_RECENTLY_USED_TAGS,
waitForCollectionCallback: true,
callback: (val) => (allRecentlyUsedTags = val),
});

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

Check warning on line 895 in src/libs/actions/IOU.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 @@ -901,7 +901,7 @@
});

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

Check warning on line 904 in src/libs/actions/IOU.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 Down Expand Up @@ -1808,6 +1808,7 @@
});

optimisticData.push(
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING}`,
Expand Down Expand Up @@ -4628,6 +4629,7 @@
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: violations?.filter((violation) => violation.name !== 'overLimit') ?? [],
});
}
Expand Down Expand Up @@ -4727,6 +4729,7 @@
value: currentTransactionViolations,
});
if (hash) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
Expand All @@ -4736,6 +4739,7 @@
},
},
});
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
Expand Down Expand Up @@ -6636,6 +6640,7 @@
});

if (isMapDistanceRequest(transaction) || isManualDistanceRequestTransactionUtils(transaction)) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
onyxData?.optimisticData?.push({
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE,
Expand Down Expand Up @@ -8328,6 +8333,7 @@
onyxData = moneyRequestOnyxData;

if (transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MAP || isManualDistanceRequest) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
onyxData?.optimisticData?.push({
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE,
Expand Down Expand Up @@ -8791,6 +8797,7 @@
value: updatedReportAction,
});
onyxUpdates.push(
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`,
Expand Down Expand Up @@ -8959,6 +8966,7 @@
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`,
value: updatedReportAction,
},
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`,
Expand Down Expand Up @@ -9107,6 +9115,7 @@
},
},
},
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
shouldDeleteIOUReport
? {
onyxMethod: Onyx.METHOD.SET,
Expand Down Expand Up @@ -9570,6 +9579,8 @@
});
}

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const optimisticData: OnyxUpdate[] = [
optimisticChatReportData,
optimisticQuickActionData,
Expand Down Expand Up @@ -10506,6 +10517,8 @@
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`,
value: optimisticNextStep,
};
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const optimisticData: OnyxUpdate[] = [optimisticIOUReportData, optimisticReportActionsData, optimisticNextStepData, ...(optimisticChatReportData ? [optimisticChatReportData] : [])];

const successData: OnyxUpdate[] = [
Expand Down Expand Up @@ -10877,6 +10890,7 @@
},
},
},
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`,
Expand Down Expand Up @@ -11741,6 +11755,7 @@
});
}
if (currentSearchQueryJSON?.hash) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}`,
Expand All @@ -11754,6 +11769,7 @@
},
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}`,
Expand Down Expand Up @@ -12212,6 +12228,7 @@
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: transactionViolations?.filter((violation) => violation.name !== CONST.VIOLATIONS.HOLD) ?? [],
},
{
Expand Down Expand Up @@ -12435,6 +12452,7 @@
return {
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${id}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: violations.filter((violation) => violation.name !== CONST.VIOLATIONS.DUPLICATED_TRANSACTION),
};
});
Expand Down Expand Up @@ -12683,6 +12701,7 @@
return {
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${id}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: updatedViolations.filter((violation) => violation.name !== CONST.VIOLATIONS.DUPLICATED_TRANSACTION),
};
});
Expand Down Expand Up @@ -12900,6 +12919,7 @@
}
return {
optimisticData: [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}` as const,
Expand Down Expand Up @@ -13307,6 +13327,7 @@
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${rejectedToReportID}`,
value: {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
parentReportID: report?.chatReportID,
},
},
Expand Down Expand Up @@ -13647,6 +13668,7 @@

// Build optimistic data
const optimisticData: OnyxUpdate[] = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
Expand Down Expand Up @@ -13674,6 +13696,7 @@
];

const failureData: OnyxUpdate[] = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
Expand Down Expand Up @@ -14210,6 +14233,7 @@
},
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`,
Expand Down Expand Up @@ -14256,6 +14280,7 @@
},
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
Expand Down
11 changes: 10 additions & 1 deletion src/libs/actions/MergeTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ function mergeTransactionRequest({
]
: [];

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
const failureSourceReportData: OnyxUpdate[] =
transactionsOfSourceReport.length === 1
? [
Expand Down Expand Up @@ -352,6 +353,7 @@ function mergeTransactionRequest({
return {
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${id}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: violations.filter((violation) => violation.name !== CONST.VIOLATIONS.DUPLICATED_TRANSACTION),
};
});
Expand All @@ -365,6 +367,8 @@ function mergeTransactionRequest({
};
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const optimisticData: OnyxUpdate[] = [
...(onyxTargetTransactionData.optimisticData ?? []),
optimisticSourceTransactionData,
Expand All @@ -374,14 +378,19 @@ function mergeTransactionRequest({
...optimisticSourceReportActionData,
];

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const failureData: OnyxUpdate[] = [
...(onyxTargetTransactionData.failureData ?? []),
failureSourceTransactionData,
...failureSourceReportData,
...failureTransactionViolations,
...failureSourceReportActionData,
];
const successData: OnyxUpdate[] = [...successSourceReportActionData, ...(onyxTargetTransactionData.successData ?? [])];

const successData: OnyxUpdate[] = [];
successData.push(...successSourceReportActionData);
successData.push(...(onyxTargetTransactionData.successData ?? []));

API.write(WRITE_COMMANDS.MERGE_TRANSACTION, params, {optimisticData, failureData, successData});
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/Policy/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ function removeMembers(policyID: string, selectedMemberEmails: string[], policyM
pendingChatMembers,
},
},
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`,
Expand Down Expand Up @@ -590,6 +591,7 @@ function removeMembers(policyID: string, selectedMemberEmails: string[], policyM
pendingChatMembers: null,
},
},
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`,
Expand Down
Loading
Loading