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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
"typecheck-tsgo": "tsgo --project tsconfig.tsgo.json",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=383 --cache --cache-location=node_modules/.cache/eslint --cache-strategy content --concurrency=auto",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=382 --cache --cache-location=node_modules/.cache/eslint --cache-strategy content --concurrency=auto",
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
"check-lazy-loading": "ts-node scripts/checkLazyLoading.ts",
"lint-watch": "npx eslint-watch --watch --changed",
Expand Down
11 changes: 2 additions & 9 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,15 @@
};

const addNewMessageWithText = new Set<string>([WRITE_COMMANDS.ADD_COMMENT, WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT]);
let conciergeReportIDOnyxConnect: string | undefined;
let deprecatedCurrentUserAccountID = -1;
/** @deprecated This value is deprecated and will be removed soon after migration. Use the email from useCurrentUserPersonalDetails hook instead. */
let deprecatedCurrentUserLogin: string | undefined;

Onyx.connect({

Check warning on line 318 in src/libs/actions/Report/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) => {
// When signed out, val is undefined
if (!value?.accountID) {
conciergeReportIDOnyxConnect = undefined;
return;
}
// eslint-disable-next-line @typescript-eslint/no-deprecated
Expand All @@ -330,15 +328,10 @@
},
});

Onyx.connect({
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => (conciergeReportIDOnyxConnect = value),
});

// map of reportID to all reportActions for that report
const allReportActions: OnyxCollection<ReportActions> = {};

Onyx.connect({

Check warning on line 334 in src/libs/actions/Report/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,
callback: (actions, key) => {
if (!key || !actions) {
Expand All @@ -350,7 +343,7 @@
});

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

Check warning on line 346 in src/libs/actions/Report/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 @@ -359,7 +352,7 @@
});

let allPersonalDetails: OnyxEntry<PersonalDetailsList> = {};
Onyx.connect({

Check warning on line 355 in src/libs/actions/Report/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 All @@ -374,7 +367,7 @@
});

let onboarding: OnyxEntry<Onboarding>;
Onyx.connect({

Check warning on line 370 in src/libs/actions/Report/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.NVP_ONBOARDING,
callback: (val) => {
if (Array.isArray(val)) {
Expand All @@ -385,7 +378,7 @@
});

let deprecatedIntroSelected: OnyxEntry<IntroSelected> = {};
Onyx.connect({

Check warning on line 381 in src/libs/actions/Report/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.NVP_INTRO_SELECTED,
callback: (val) => (deprecatedIntroSelected = val),
});
Expand Down Expand Up @@ -4056,9 +4049,9 @@
}
}

function getMostRecentReportID(currentReport: OnyxEntry<Report>) {
function getMostRecentReportID(currentReport: OnyxEntry<Report>, conciergeReportID: string | undefined) {
const lastAccessedReportID = findLastAccessedReport(false, false, currentReport?.reportID)?.reportID;
return lastAccessedReportID ?? conciergeReportIDOnyxConnect;
return lastAccessedReportID ?? conciergeReportID;
}

function joinRoom(report: OnyxEntry<Report>, currentUserAccountID: number) {
Expand Down
7 changes: 4 additions & 3 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ function getShareDestination(
* @param report - The task report being deleted
* @returns The URL to navigate to
*/
function getNavigationUrlOnTaskDelete(report: OnyxEntry<OnyxTypes.Report>): string | undefined {
function getNavigationUrlOnTaskDelete(report: OnyxEntry<OnyxTypes.Report>, conciergeReportID: string | undefined): string | undefined {
if (!report) {
return undefined;
}
Expand All @@ -1040,7 +1040,7 @@ function getNavigationUrlOnTaskDelete(report: OnyxEntry<OnyxTypes.Report>): stri
}

// If no parent report, try to navigate to most recent report
const mostRecentReportID = getMostRecentReportID(report);
const mostRecentReportID = getMostRecentReportID(report, conciergeReportID);
if (mostRecentReportID) {
return ROUTES.REPORT_WITH_ID.getRoute(mostRecentReportID);
}
Expand All @@ -1058,6 +1058,7 @@ function deleteTask(
currentUserAccountID: number,
hasOutstandingChildTask: boolean,
parentReportAction: OnyxEntry<ReportAction>,
conciergeReportID: string | undefined,
ancestors: ReportUtils.Ancestor[] = [],
) {
if (!report) {
Expand Down Expand Up @@ -1183,7 +1184,7 @@ function deleteTask(
API.write(WRITE_COMMANDS.CANCEL_TASK, parameters, {optimisticData, successData, failureData});
notifyNewAction(report.reportID, undefined, true);

const urlToNavigateBack = getNavigationUrlOnTaskDelete(report);
const urlToNavigateBack = getNavigationUrlOnTaskDelete(report, conciergeReportID);
if (urlToNavigateBack) {
Navigation.goBack();
return urlToNavigateBack;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail

const deleteTransaction = useCallback(() => {
if (caseID === CASES.DEFAULT) {
deleteTask(report, parentReport, isReportArchived, currentUserPersonalDetails.accountID, hasOutstandingChildTask, parentReportAction, ancestors);
deleteTask(report, parentReport, isReportArchived, currentUserPersonalDetails.accountID, hasOutstandingChildTask, parentReportAction, conciergeReportID, ancestors);
return;
}

Expand Down Expand Up @@ -928,6 +928,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
deleteTransactions,
currentSearchHash,
removeTransaction,
conciergeReportID,
]);

// Where to navigate back to after deleting the transaction and its report.
Expand Down
Loading
Loading