Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d7a0231
Remove @ts-expect-error comments
OlGierd03 Feb 12, 2026
0c51a22
Merge '@OlGierd03/replace_union_OnyxKey_type_seventh_batch' branch
OlGierd03 Feb 13, 2026
5097362
Remove comments
OlGierd03 Feb 13, 2026
78aacfc
Remove @ts-expect-error comments
OlGierd03 Feb 16, 2026
9c896df
Merge branch '@OlGierd03/replace_union_OnyxKey_type_seventh_batch' in…
OlGierd03 Feb 16, 2026
f1d6970
Remove @ts-expect-error comments
OlGierd03 Feb 16, 2026
8ab0366
Remove @ts-expect-error comments
OlGierd03 Feb 16, 2026
f5dc884
Remove @ts-expect-error comment
OlGierd03 Feb 16, 2026
fd288e5
Delete unnecessary errors prop with null value
OlGierd03 Feb 16, 2026
732f2b5
Merge branch '@OlGierd03/replace_union_OnyxKey_type_seventh_batch' in…
OlGierd03 Feb 19, 2026
9900cf2
Merge 'main' branch
OlGierd03 Feb 22, 2026
7579598
Merge branch 'main' into @OlGierd03/remove-all-ts-expect-errors-comments
OlGierd03 Feb 23, 2026
48079c5
Run prettier
OlGierd03 Feb 23, 2026
e2ee140
Fix failing test
OlGierd03 Feb 23, 2026
b5650d2
Merge 'main' branch
OlGierd03 Feb 24, 2026
b337b37
Merge branch 'main' into @OlGierd03/remove-all-ts-expect-errors-comments
OlGierd03 Mar 9, 2026
c81a98a
Merge 'main' branch
OlGierd03 Mar 12, 2026
eba5878
Merge branch 'main' into @OlGierd03/remove-all-ts-expect-errors-comments
OlGierd03 Mar 19, 2026
0c39f96
Correct previous changes in Report, Search and Transaction
OlGierd03 Mar 20, 2026
6ab13cb
Merge branch 'main' into @OlGierd03/remove-all-ts-expect-errors-comments
OlGierd03 Mar 20, 2026
b10dca2
Extend DistanceExpenseType with new distance expense types
OlGierd03 Mar 27, 2026
0f84000
Merge 'main' branch
OlGierd03 Mar 27, 2026
2e467bc
Merge main and resolve conflicts
OlGierd03 Apr 10, 2026
ac1fdb5
Remove unused import
OlGierd03 Apr 10, 2026
4384667
Merge branch 'main' into @OlGierd03/remove-all-ts-expect-errors-comments
OlGierd03 Apr 10, 2026
a3c9028
Clear errors properly
OlGierd03 Apr 10, 2026
20ee419
Merge main and resolve conflicts
OlGierd03 Apr 14, 2026
1d0a782
Pass reportNextStep to changeReportPolicyAndInviteSubmitter to preser…
OlGierd03 Apr 14, 2026
751fc58
Delete data value after the SNAPSHOT request fails
OlGierd03 Apr 14, 2026
897b7ed
Fix optimistic update value for REPORT in actions/Search.ts
OlGierd03 Apr 14, 2026
af2dc94
Tighten the null-check guards in SearchUIUtils and SearchPage so that…
OlGierd03 Apr 15, 2026
5e7eb64
Add dismissedMethod: 'click' in buildOnyxDataForMoneyRequest to match…
OlGierd03 Apr 15, 2026
c07504c
Pass through snapshots that have errors in SearchPage searchResults u…
OlGierd03 Apr 15, 2026
d6d914b
Fix isSearchDataLoaded to stop Search from showing shouldShowLoadingS…
OlGierd03 Apr 15, 2026
911a469
Merge branch 'main' into @OlGierd03/remove-all-ts-expect-errors-comments
OlGierd03 Apr 15, 2026
a3742c6
Prevent failed requests from TypeError crashes
OlGierd03 Apr 15, 2026
cc777df
Merge main and resolve conflicts
OlGierd03 Apr 16, 2026
7495f4f
Let Search mount when errorrs are present so it can render FullPageEr…
OlGierd03 Apr 16, 2026
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
2 changes: 1 addition & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@
const prevIsSearchResultEmpty = usePrevious(isSearchResultsEmpty);

const [baseFilteredData, filteredDataLength, allDataLength] = useMemo(() => {
if (shouldDeferHeavySearchWork || searchResults === undefined || !isDataLoaded) {
if (shouldDeferHeavySearchWork || searchResults === undefined || !isDataLoaded || !searchResults.data) {
return [[], 0, 0];
}

Expand Down Expand Up @@ -1172,7 +1172,7 @@
markReportIDAsExpense,
toggleTransaction,
handleSearch,
currentSearchKey,

Check warning on line 1175 in src/components/Search/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useCallback has an unnecessary dependency: 'currentSearchKey'. Either exclude it or remove the dependency array

Check warning on line 1175 in src/components/Search/index.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useCallback has an unnecessary dependency: 'currentSearchKey'. Either exclude it or remove the dependency array
markReportIDAsMultiTransactionExpense,
unmarkReportIDAsMultiTransactionExpense,
introSelected,
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useSearchLoadingState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ function useSearchLoadingState(queryJSON: SearchQueryJSON | undefined, searchRes
const validGroupBy = getValidGroupBy(queryJSON.groupBy);
const isCardFeedsLoading = validGroupBy === CONST.SEARCH.GROUP_BY.CARD && cardFeedsResult?.status === 'loading';

const hasErrors = Object.keys(searchResults?.errors ?? {}).length > 0;

// Show page-level skeleton when no data has ever arrived for this query,
// or when card feeds are still loading for card-grouped searches.
// Once data arrives (even empty []), Search mounts and handles its own
// loading/empty states internally via shouldShowLoadingState.
return hasNoData || isCardFeedsLoading;
// When errors are present, let Search mount so it can render FullPageErrorView.
return (hasNoData && !hasErrors) || isCardFeedsLoading;
}

export default useSearchLoadingState;
3 changes: 2 additions & 1 deletion src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4401,7 +4401,8 @@ function isSearchDataLoaded(searchResults: SearchResults | undefined, queryJSON:
? searchResults?.search?.status?.split(',').sort().join(',')
: searchResults?.search?.status?.sort().join(',');
const sortedQueryJSONStatus = Array.isArray(status) ? status.sort().join(',') : status;
const isDataLoaded = searchResults?.data !== undefined && searchResults?.search?.type === queryJSON?.type && sortedSearchResultStatus === sortedQueryJSONStatus;
const isDataLoaded =
(searchResults?.data != null || searchResults?.errors != null) && searchResults?.search?.type === queryJSON?.type && sortedSearchResultStatus === sortedQueryJSONStatus;

return isDataLoaded;
}
Expand Down
12 changes: 11 additions & 1 deletion src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import type {
TransactionViolations,
ViolationName,
} from '@src/types/onyx';
import type {Attendee, Participant, SplitExpense} from '@src/types/onyx/IOU';
import type {Attendee, DistanceExpenseType, Participant, SplitExpense} from '@src/types/onyx/IOU';
import type {Errors, PendingAction} from '@src/types/onyx/OnyxCommon';
import type {CurrentUserPersonalDetails} from '@src/types/onyx/PersonalDetails';
import type {OnyxData} from '@src/types/onyx/Request';
Expand Down Expand Up @@ -278,6 +278,15 @@ function isTimeRequest(transaction: OnyxEntry<Transaction>): boolean {
return transaction?.comment?.type === CONST.TRANSACTION.TYPE.TIME;
}

function isDistanceExpenseType(requestType: IOURequestType | undefined): requestType is DistanceExpenseType {
return (
requestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MAP ||
requestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MANUAL ||
requestType === CONST.IOU.REQUEST_TYPE.DISTANCE_GPS ||
requestType === CONST.IOU.REQUEST_TYPE.DISTANCE_ODOMETER
);
}

function isCorporateCardTransaction(transaction: OnyxEntry<Transaction>): boolean {
return isManagedCardTransaction(transaction) && transaction?.comment?.liabilityType === CONST.TRANSACTION.LIABILITY_TYPE.RESTRICT;
}
Expand Down Expand Up @@ -2864,6 +2873,7 @@ export {
isGPSDistanceRequest,
isManualDistanceRequest,
isOdometerDistanceRequest,
isDistanceExpenseType,
isFetchingWaypointsFromServer,
isExpensifyCardTransaction,
isManagedCardTransaction,
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ function reportVirtualExpensifyCardFraud(card: Card, validateCode: string) {
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.FORMS.REPORT_VIRTUAL_CARD_FRAUD,
value: {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
cardID,
cardID: cardID.toString(),
isLoading: true,
errors: null,
},
Expand Down
7 changes: 2 additions & 5 deletions src/libs/actions/IOU/RejectMoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ function prepareRejectMoneyRequestData(
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 @@ -902,11 +901,10 @@ function markRejectViolationAsResolved(transactionID: string, isOffline: boolean

// Build optimistic data
const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS>> = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
value: updatedViolations,
value: updatedViolations ?? null,
},
{
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -930,11 +928,10 @@ function markRejectViolationAsResolved(transactionID: string, isOffline: boolean
];

const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS>> = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
value: currentViolations,
value: currentViolations ?? null,
},
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU/Split.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1950,11 +1950,10 @@ function updateSplitTransactions({
},
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
onyxData.failureData?.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`,
value: originalTransaction,
value: originalTransaction ?? null,
});

if (firstIOU) {
Expand Down
12 changes: 3 additions & 9 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
getCategoryTaxCodeAndAmount,
getCurrency,
getDistanceInMeters,
isDistanceExpenseType,
isDistanceRequest as isDistanceRequestTransactionUtils,
isManualDistanceRequest as isManualDistanceRequestTransactionUtils,
isOdometerDistanceRequest as isOdometerDistanceRequestTransactionUtils,
Expand Down Expand Up @@ -378,7 +379,7 @@
};

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

Check warning on line 382 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 @@ -430,7 +431,7 @@
};

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

Check warning on line 434 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 @@ -444,7 +445,7 @@
});

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

Check warning on line 448 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 @@ -453,7 +454,7 @@
});

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

Check warning on line 457 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 @@ -467,7 +468,7 @@
});

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

Check warning on line 471 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 @@ -480,7 +481,7 @@
});

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

Check warning on line 484 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 @@ -489,7 +490,7 @@
});

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

Check warning on line 493 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 @@ -499,7 +500,7 @@

let deprecatedUserAccountID = -1;
let deprecatedCurrentUserEmail = '';
Onyx.connect({

Check warning on line 503 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) => {
deprecatedCurrentUserEmail = value?.email ?? '';
Expand All @@ -508,7 +509,7 @@
});

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

Check warning on line 512 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?.[deprecatedUserAccountID] ?? undefined;
Expand Down Expand Up @@ -1695,8 +1696,7 @@
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: {[CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP]: DateUtils.getDBTime(date.valueOf())},
value: {[CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP]: {timestamp: DateUtils.getDBTime(date.valueOf()), dismissedMethod: 'click'}},
},
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -3461,16 +3461,10 @@

const isGPSDistanceRequest = transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_GPS;

if (
transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MAP ||
isGPSDistanceRequest ||
isManualDistanceRequest ||
transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_ODOMETER
) {
if (isDistanceExpenseType(transaction.iouRequestType)) {
onyxData?.optimisticData?.push({
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: transaction.iouRequestType,
});
}
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/MergeTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,13 @@ function mergeTransactionRequest({
]
: [];

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
const failureReportDeletionData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS>> =
transactionsOfDeletableReport.length === 1
? [
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT}${transactionToDelete.reportID}`,
value: getReportOrDraftReport(transactionToDelete.reportID),
value: getReportOrDraftReport(transactionToDelete.reportID) ?? null,
},
]
: [];
Expand Down
8 changes: 3 additions & 5 deletions src/libs/actions/Policy/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ function removeMembers(policy: OnyxEntry<Policy>, selectedMemberEmails: string[]
const pendingChatMembers = ReportUtils.getPendingChatMembers(accountIDs, [], CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);

for (const report of workspaceChats) {
const currentTime = DateUtils.getDBTime();
optimisticData.push(
{
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -472,12 +473,10 @@ function removeMembers(policy: OnyxEntry<Policy>, selectedMemberEmails: string[]
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`,
value: {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
private_isArchived: true,
private_isArchived: currentTime,
},
},
);
const currentTime = DateUtils.getDBTime();
const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`] ?? {};
for (const action of Object.values(reportActions)) {
if (action.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) {
Expand Down Expand Up @@ -517,8 +516,7 @@ function removeMembers(policy: OnyxEntry<Policy>, selectedMemberEmails: string[]
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`,
value: {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
private_isArchived: false,
private_isArchived: null,
},
},
);
Expand Down
15 changes: 5 additions & 10 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,10 @@ function deleteWorkspace(params: DeleteWorkspaceActionParams) {
pendingAction: null,
},
},
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`,
value: policyCardFeeds,
value: policyCardFeeds ?? null,
},
];

Expand All @@ -488,11 +487,10 @@ function deleteWorkspace(params: DeleteWorkspaceActionParams) {

const newActivePolicyID = mostRecentlyCreatedGroupPolicy?.id ?? personalPolicyID;

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
value: newActivePolicyID,
value: newActivePolicyID ?? null,
});

failureData.push({
Expand Down Expand Up @@ -590,17 +588,15 @@ function deleteWorkspace(params: DeleteWorkspaceActionParams) {
for (const transactionViolationKey of Object.keys(transactionViolations ?? {})) {
const transactionViolation = transactionViolations?.[transactionViolationKey];
const transactionID = transactionViolationKey.slice(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS.length);
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
value: transactionViolation?.filter((violation) => violation.type !== CONST.VIOLATION_TYPES.VIOLATION),
value: transactionViolation?.filter((violation) => violation.type !== CONST.VIOLATION_TYPES.VIOLATION) ?? null,
});
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
value: transactionViolation,
value: transactionViolation ?? null,
});
}
}
Expand Down Expand Up @@ -1574,8 +1570,7 @@ function createPolicyExpenseChats(
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${oldChat.reportID}`,
value: {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
private_isArchived: false,
private_isArchived: null,
},
});
const currentTime = DateUtils.getDBTime();
Expand Down
22 changes: 9 additions & 13 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3660,8 +3660,7 @@ function buildNewReportOptimisticData(
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
value: {[reportActionID]: {errorFields: {createReport: getMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage')}}},
value: {[reportActionID]: {errors: {createReport: getMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage')}}},
},

{
Expand Down Expand Up @@ -3690,8 +3689,7 @@ function buildNewReportOptimisticData(
value: {
[reportActionID]: {
pendingAction: null,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
errorFields: null,
Comment thread
OlGierd03 marked this conversation as resolved.
errors: null,
},
},
},
Expand All @@ -3701,8 +3699,7 @@ function buildNewReportOptimisticData(
value: {
[reportPreviewReportActionID]: {
pendingAction: null,
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
errorFields: null,
Comment thread
OlGierd03 marked this conversation as resolved.
errors: null,
},
},
},
Expand Down Expand Up @@ -5973,11 +5970,10 @@ function deleteAppReport({
value: null,
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: reportActionsForReport,
value: reportActionsForReport ?? null,
});

// 7. Mark the iouReport as being deleted and then delete it
Expand Down Expand Up @@ -6471,12 +6467,11 @@ function dismissChangePolicyModal() {
value: {
[CONST.CHANGE_POLICY_TRAINING_MODAL]: {
timestamp: DateUtils.getDBTime(date.valueOf()),
dismissedMethod: 'click',
dismissedMethod: 'click' as const,
},
},
},
];
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
API.write(WRITE_COMMANDS.DISMISS_PRODUCT_TRAINING, {name: CONST.CHANGE_POLICY_TRAINING_MODAL, dismissedMethod: 'click'}, {optimisticData});
}

Expand Down Expand Up @@ -6722,11 +6717,10 @@ function buildOptimisticChangePolicyData(
},
});

// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
value: reportNextStep,
value: reportNextStep ?? null,
Comment thread
OlGierd03 marked this conversation as resolved.
});
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -7100,6 +7094,7 @@ function changeReportPolicyAndInviteSubmitter({
employeeList,
formatPhoneNumber,
isReportLastVisibleArchived,
reportNextStep,
}: {
report: Report;
parentReport: OnyxEntry<Report>;
Expand All @@ -7112,6 +7107,7 @@ function changeReportPolicyAndInviteSubmitter({
employeeList: PolicyEmployeeList | undefined;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
isReportLastVisibleArchived: boolean | undefined;
reportNextStep: OnyxEntry<ReportNextStepDeprecated>;
}) {
if (!report.reportID || !policy?.id || report.policyID === policy.id || !isExpenseReport(report) || !report.ownerAccountID) {
return;
Expand Down Expand Up @@ -7159,7 +7155,7 @@ function changeReportPolicyAndInviteSubmitter({
hasViolationsParam,
isASAPSubmitBetaEnabled,
isReportLastVisibleArchived,
undefined,
reportNextStep,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree on the change, but i think it might change the behaviour .. is it a part of the TS changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed a behavioral change, but it's a bug fix that was necessary to make the @ts-expect-error removal work correctly.

Previously, passing undefined here meant that on API failure, buildOptimisticChangePolicyData would restore NEXT_STEP to null (via reportNextStep ?? null), effectively wiping it. Now we pass the actual value from Onyx so NEXT_STEP is properly preserved on rollback.

membersChats.reportCreationData[submitterEmail],
);

Expand Down
6 changes: 2 additions & 4 deletions src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,11 @@ function getOnyxLoadingData(
];

const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.SNAPSHOT>> = [
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`,
value: {
...(isOffline ? {} : {data: []}),
...(isOffline ? {} : {data: null}),
search: {
status: queryJSON?.status,
type: queryJSON?.type,
Expand Down Expand Up @@ -1652,8 +1651,7 @@ function setOptimisticDataForTransactionThreadPreview(item: TransactionListItemT
const onyxUpdates: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS | typeof ONYXKEYS.COLLECTION.TRANSACTION>> = [];

// Set optimistic parent report
if (!hasParentReport) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
if (!hasParentReport && report) {
onyxUpdates.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
Expand Down
Loading
Loading