From 0f2497949cc9d7c0300ce6ec3e9cf717a3ce7fb2 Mon Sep 17 00:00:00 2001 From: hurali97 Date: Thu, 4 Jul 2024 16:20:07 +0500 Subject: [PATCH 1/3] fix: list not scrolling to the linked action --- src/pages/home/ReportScreen.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 3c2ae7bbc6e6..dafd31be5f3b 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -406,7 +406,8 @@ function ReportScreen({ return reportIDFromRoute !== '' && !!report.reportID && !isTransitioning; }, [report, reportIDFromRoute]); - const isLoading = isLoadingApp ?? (!reportIDFromRoute || (!isSidebarLoaded && !isReportOpenInRHP) || PersonalDetailsUtils.isPersonalDetailsEmpty()); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const isLoading = isLoadingApp || !reportIDFromRoute || (!isSidebarLoaded && !isReportOpenInRHP) || PersonalDetailsUtils.isPersonalDetailsEmpty(); const shouldShowSkeleton = !isLinkedMessageAvailable && (isLinkingToMessage || From e19bc4aa82ebeca3927048d8a3ce2e74c6bc4ff4 Mon Sep 17 00:00:00 2001 From: hurali97 Date: Thu, 4 Jul 2024 16:20:42 +0500 Subject: [PATCH 2/3] revert: [CP Staging] Add back comment linking beta --- src/CONST.ts | 1 - src/libs/Permissions.ts | 5 ----- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 5 ----- 3 files changed, 11 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 00f2245a55c0..9bba8d509642 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -369,7 +369,6 @@ const CONST = { WORKSPACE_FEEDS: 'workspaceFeeds', NETSUITE_USA_TAX: 'netsuiteUsaTax', INTACCT_ON_NEW_EXPENSIFY: 'intacctOnNewExpensify', - COMMENT_LINKING: 'commentLinking', }, BUTTON_STATES: { DEFAULT: 'default', diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index aafc38a9040b..faea5965fee4 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -60,10 +60,6 @@ function canUseNetSuiteUSATax(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.NETSUITE_USA_TAX) || canUseAllBetas(betas); } -function canUseCommentLinking(betas: OnyxEntry): boolean { - return !!betas?.includes(CONST.BETAS.COMMENT_LINKING) || canUseAllBetas(betas); -} - /** * Link previews are temporarily disabled. */ @@ -86,5 +82,4 @@ export default { canUseReportFieldsFeature, canUseWorkspaceFeeds, canUseNetSuiteUSATax, - canUseCommentLinking, }; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 0e29e7496def..bf634b4ac8ae 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -19,7 +19,6 @@ import * as Localize from '@libs/Localize'; import ModifiedExpenseMessage from '@libs/ModifiedExpenseMessage'; import Navigation from '@libs/Navigation/Navigation'; import {parseHtmlToMarkdown, parseHtmlToText} from '@libs/OnyxAwareParser'; -import Permissions from '@libs/Permissions'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -426,10 +425,6 @@ const ContextMenuActions: ContextMenuAction[] = [ successIcon: Expensicons.Checkmark, successTextTranslateKey: 'reportActionContextMenu.copied', shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget) => { - if (!Permissions.canUseCommentLinking(betas)) { - return false; - } - const isAttachment = ReportActionsUtils.isReportActionAttachment(reportAction); // Only hide the copylink menu item when context menu is opened over img element. From d6add1931c6ef8d285da8c1d9d80e766e7c24700 Mon Sep 17 00:00:00 2001 From: hurali97 Date: Thu, 4 Jul 2024 18:20:56 +0500 Subject: [PATCH 3/3] docs: add comments --- src/pages/home/ReportScreen.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index dafd31be5f3b..ceee1972256f 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -406,6 +406,11 @@ function ReportScreen({ return reportIDFromRoute !== '' && !!report.reportID && !isTransitioning; }, [report, reportIDFromRoute]); + /** + * Using logical OR operator because with nullish coalescing operator, when `isLoadingApp` is false, the right hand side of the operator + * is not evaluated. This causes issues where we have `isLoading` set to false and later set to true and then set to false again. + * Ideally, `isLoading` should be set initially to true and then set to false. We can achieve this by using logical OR operator. + */ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const isLoading = isLoadingApp || !reportIDFromRoute || (!isSidebarLoaded && !isReportOpenInRHP) || PersonalDetailsUtils.isPersonalDetailsEmpty(); const shouldShowSkeleton =