Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8d08b24
feat: Add visible report actions derived value and related utilities
BartekObudzinski Dec 31, 2025
79e271d
Optimize visible report actions filtering logic for improved performance
BartekObudzinski Dec 31, 2025
c50b1d9
Refactor: Remove commented-out code and improve clarity in visible re…
BartekObudzinski Dec 31, 2025
53c26e1
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 7, 2026
df57915
MoneyRequestReportActionsList to include additional visibility checks…
BartekObudzinski Jan 7, 2026
99d1cff
Remove unused report action utility functions from ReportActionsUtils.ts
BartekObudzinski Jan 7, 2026
ef613d3
prettier fix
BartekObudzinski Jan 7, 2026
b3beaf8
replace shouldReportActionBeVisible
BartekObudzinski Jan 9, 2026
9f13088
compute derived shouldRepportActionBeVisible
BartekObudzinski Jan 9, 2026
f641baf
Refactor telemetry settings for improved performance tracing and remo…
BartekObudzinski Jan 12, 2026
a89c810
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 12, 2026
6ce80ff
Refactor report action visibility checks to handle undefined report I…
BartekObudzinski Jan 12, 2026
706c531
Refactor report ID handling in visibility checks to ensure proper eva…
BartekObudzinski Jan 12, 2026
4947b09
Add reportID to report actions in tests for consistency and improved …
BartekObudzinski Jan 12, 2026
73a1b56
Add reportID to additional report actions in SidebarUtils tests for c…
BartekObudzinski Jan 12, 2026
c85f35c
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 13, 2026
4751281
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 14, 2026
22c2deb
Added reportID to MOVED_TRANSACTION and ADD_COMMENT actions in Report…
BartekObudzinski Jan 14, 2026
95f9bcf
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 15, 2026
91c9fd1
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 15, 2026
79df49c
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 15, 2026
115d317
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 19, 2026
3487e57
Enhance report action visibility logic by adding check for actionable…
BartekObudzinski Jan 19, 2026
685e6ce
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 19, 2026
2d9cb15
Refactor report action visibility logic by introducing a caching skip…
BartekObudzinski Jan 19, 2026
af2c5b3
prettier fix
BartekObudzinski Jan 19, 2026
4d41b85
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 19, 2026
5edee2e
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 19, 2026
9e0fff3
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 20, 2026
81b472e
Add visible report actions data to various components and utility fun…
BartekObudzinski Jan 20, 2026
eaab49c
Add visible report actions data to Search components and utility func…
BartekObudzinski Jan 20, 2026
6eed145
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 20, 2026
845dae6
Refactor: Remove nullish coalescing for visibleReportActionsData in S…
BartekObudzinski Jan 20, 2026
27989e1
Refactor: Update translation handling in getAlternateText and createO…
BartekObudzinski Jan 20, 2026
d425f90
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 20, 2026
e2a6005
Disable ESLint max-lines rule in ReportActionsUtils.ts
BartekObudzinski Jan 20, 2026
f5bab35
Add visibleReportActionsData prop to SearchAutocompleteList component
BartekObudzinski Jan 20, 2026
0bf8069
Revert "Add visibleReportActionsData prop to SearchAutocompleteList c…
BartekObudzinski Jan 20, 2026
53edd1c
Add visibleReportActionsData prop to getSections function in SearchUI…
BartekObudzinski Jan 21, 2026
755c0c5
Refactor LHNOptionsList and SidebarUtils to utilize getLastVisibleAct…
BartekObudzinski Jan 21, 2026
82d5612
prettier eslint fix
BartekObudzinski Jan 21, 2026
a4f5588
Enhance LHNOptionsList and ReportActionsUtils to improve actor accoun…
BartekObudzinski Jan 21, 2026
bc8f9a2
Refactor LHNOptionsList and ReportActionsUtils for improved readabili…
BartekObudzinski Jan 21, 2026
d162f68
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
BartekObudzinski Jan 21, 2026
5fec346
Refactor ReportActionsUtils to ensure safe access of message properti…
BartekObudzinski Jan 21, 2026
8a3bf2f
Update SearchAutocompleteList, useSearchSelectorBase, and ShareTab to…
BartekObudzinski Jan 21, 2026
354c5c1
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 22, 2026
d6f62eb
revert
BartekObudzinski Jan 22, 2026
d939a6c
Merge remote-tracking branch 'upstream/main' into feat/visible-report…
BartekObudzinski Jan 22, 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: 2 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ const ONYXKEYS = {
REPORT_ATTRIBUTES: 'reportAttributes',
REPORT_TRANSACTIONS_AND_VIOLATIONS: 'reportTransactionsAndViolations',
OUTSTANDING_REPORTS_BY_POLICY_ID: 'outstandingReportsByPolicyID',
VISIBLE_REPORT_ACTIONS: 'visibleReportActions',
},

/** Stores HybridApp specific state required to interoperate with OldDot */
Expand Down Expand Up @@ -1394,6 +1395,7 @@ type OnyxDerivedValuesMapping = {
[ONYXKEYS.DERIVED.REPORT_ATTRIBUTES]: OnyxTypes.ReportAttributesDerivedValue;
[ONYXKEYS.DERIVED.REPORT_TRANSACTIONS_AND_VIOLATIONS]: OnyxTypes.ReportTransactionsAndViolationsDerivedValue;
[ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID]: OnyxTypes.OutstandingReportsByPolicyIDDerivedValue;
[ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS]: OnyxTypes.VisibleReportActionsDerivedValue;
};

type OnyxValues = OnyxValuesMapping & OnyxCollectionValuesMapping & OnyxFormValuesMapping & OnyxFormDraftValuesMapping & OnyxDerivedValuesMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {Attachment} from '@components/Attachments/types';
import {getFileName, splitExtensionFromFileName} from '@libs/fileDownload/FileUtils';
import {getHtmlWithAttachmentID, getReportActionHtml, getReportActionMessage, getSortedReportActions, isMoneyRequestAction, shouldReportActionBeVisible} from '@libs/ReportActionsUtils';
import {getHtmlWithAttachmentID, getReportActionHtml, getReportActionMessage, getSortedReportActions, isMoneyRequestAction, isReportActionVisible} from '@libs/ReportActionsUtils';
import {canUserPerformWriteAction} from '@libs/ReportUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import CONST from '@src/CONST';
import type {Report, ReportAction, ReportActions} from '@src/types/onyx';
import type {Report, ReportAction, ReportActions, VisibleReportActionsDerivedValue} from '@src/types/onyx';
import type {Note} from '@src/types/onyx/Report';

/**
Expand All @@ -22,13 +22,15 @@ function extractAttachments(
reportActions,
report,
isReportArchived,
visibleReportActionsData,
}: {
privateNotes?: Record<number, Note>;
accountID?: number;
parentReportAction?: OnyxEntry<ReportAction>;
reportActions?: OnyxEntry<ReportActions>;
report: OnyxEntry<Report>;
isReportArchived: boolean | undefined;
visibleReportActionsData?: VisibleReportActionsDerivedValue;
},
) {
const targetNote = privateNotes?.[Number(accountID)]?.note ?? '';
Expand Down Expand Up @@ -115,9 +117,13 @@ function extractAttachments(
return attachments.reverse();
}

const reportID = report?.reportID;
if (!reportID) {
return attachments.reverse();
}
const actions = [...(parentReportAction ? [parentReportAction] : []), ...getSortedReportActions(Object.values(reportActions ?? {}))];
for (const [key, action] of actions.entries()) {
if (!shouldReportActionBeVisible(action, key, canUserPerformAction) || isMoneyRequestAction(action)) {
for (const action of actions) {
if (!isReportActionVisible(action, reportID, canUserPerformAction, visibleReportActionsData) || isMoneyRequestAction(action)) {
continue;
}

Expand Down
86 changes: 43 additions & 43 deletions src/components/LHNOptionsList/LHNOptionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import type {BlockingViewProps} from '@components/BlockingViews/BlockingView';
import BlockingView from '@components/BlockingViews/BlockingView';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 13 in src/components/LHNOptionsList/LHNOptionsList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 13 in src/components/LHNOptionsList/LHNOptionsList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider';
import TextBlock from '@components/TextBlock';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
Expand All @@ -29,20 +29,19 @@
import {getMovedReportID} from '@libs/ModifiedExpenseMessage';
import {getIOUReportIDOfLastAction, getLastMessageTextForReport} from '@libs/OptionsListUtils';
import {
getLastVisibleAction,
getOneTransactionThreadReportID,
getOriginalMessage,
getSortedReportActions,
getSortedReportActionsForDisplay,
getReportActionActorAccountID,
isInviteOrRemovedAction,
isMoneyRequestAction,
shouldReportActionBeVisibleAsLastAction,
} from '@libs/ReportActionsUtils';
import {canUserPerformWriteAction as canUserPerformWriteActionUtil} from '@libs/ReportUtils';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
import type {PersonalDetails, Report, ReportAction} from '@src/types/onyx';
import type {PersonalDetails, Report} from '@src/types/onyx';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import OptionRowLHNData from './OptionRowLHNData';
import OptionRowRendererComponent from './OptionRowRendererComponent';
Expand Down Expand Up @@ -72,6 +71,7 @@
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true});
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY, {canBeMissing: true});
const [visibleReportActionsData] = useOnyx(ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS, {canBeMissing: true});
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const {policyForMovingExpensesID} = usePolicyForMovingExpenses();

Expand Down Expand Up @@ -192,9 +192,6 @@
}
const itemInvoiceReceiverPolicy = policy?.[`${ONYXKEYS.COLLECTION.POLICY}${invoiceReceiverPolicyID}`];

const iouReportIDOfLastAction = getIOUReportIDOfLastAction(item);
const itemIouReportReportActions = iouReportIDOfLastAction ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportIDOfLastAction}`] : undefined;

const itemPolicy = policy?.[`${ONYXKEYS.COLLECTION.POLICY}${item?.policyID}`];
const transactionID = isMoneyRequestAction(itemParentReportAction)
? (getOriginalMessage(itemParentReportAction)?.IOUTransactionID ?? CONST.DEFAULT_NUMBER_ID)
Expand All @@ -206,54 +203,56 @@

const isReportArchived = !!itemReportNameValuePairs?.private_isArchived;
const canUserPerformWrite = canUserPerformWriteActionUtil(item, isReportArchived);
const sortedReportActions = getSortedReportActionsForDisplay(itemReportActions, canUserPerformWrite);
const lastReportAction = sortedReportActions.at(0);
const lastAction = getLastVisibleAction(
reportID,
canUserPerformWrite,
{},
itemReportActions ? {[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`]: itemReportActions} : undefined,
visibleReportActionsData,
);

// Get the transaction for the last report action
const lastReportActionTransactionID = isMoneyRequestAction(lastReportAction)
? (getOriginalMessage(lastReportAction)?.IOUTransactionID ?? CONST.DEFAULT_NUMBER_ID)
: CONST.DEFAULT_NUMBER_ID;
const iouReportIDOfLastAction = getIOUReportIDOfLastAction(item, visibleReportActionsData, lastAction);
const itemIouReportReportActions = iouReportIDOfLastAction ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportIDOfLastAction}`] : undefined;

const lastReportActionTransactionID = isMoneyRequestAction(lastAction) ? (getOriginalMessage(lastAction)?.IOUTransactionID ?? CONST.DEFAULT_NUMBER_ID) : CONST.DEFAULT_NUMBER_ID;
const lastReportActionTransaction = transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${lastReportActionTransactionID}`];

// SidebarUtils.getOptionData in OptionRowLHNData does not get re-evaluated when the linked task report changes, so we have the lastMessageTextFromReport evaluation logic here
let lastActorDetails: Partial<PersonalDetails> | null = item?.lastActorAccountID && personalDetails?.[item.lastActorAccountID] ? personalDetails[item.lastActorAccountID] : null;
if (!lastActorDetails && lastReportAction) {
const lastActorDisplayName = lastReportAction?.person?.[0]?.text;
const lastActorAccountID = getReportActionActorAccountID(lastAction, undefined, item) ?? item.lastActorAccountID;
let lastActorDetails: Partial<PersonalDetails> | null = lastActorAccountID && personalDetails?.[lastActorAccountID] ? personalDetails[lastActorAccountID] : null;

if (!lastActorDetails && lastAction) {
const lastActorDisplayName = lastAction?.person?.[0]?.text;
lastActorDetails = lastActorDisplayName
? {
displayName: lastActorDisplayName,
accountID: item?.lastActorAccountID,
accountID: lastActorAccountID,
}
: null;
}
const movedFromReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastReportAction, CONST.REPORT.MOVE_TYPE.FROM)}`];
const movedToReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastReportAction, CONST.REPORT.MOVE_TYPE.TO)}`];

const movedFromReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.FROM)}`];
const movedToReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.TO)}`];
const itemReportMetadata = reportMetadataCollection?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`];
const lastMessageTextFromReport = getLastMessageTextForReport({
translate,
report: item,
lastActorDetails,
movedFromReport,
movedToReport,
policy: itemPolicy,
isReportArchived: !!itemReportNameValuePairs?.private_isArchived,
policyForMovingExpensesID,
reportMetadata: itemReportMetadata,
});

const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === reportID;
// For archived reports, always call getLastMessageTextForReport to get the archive reason message
// instead of using lastMessageText from the report
const lastMessageTextFromReport =
(isReportArchived ? undefined : item.lastMessageText) ??
getLastMessageTextForReport({
translate,
report: item,
lastActorDetails,
movedFromReport,
movedToReport,
policy: itemPolicy,
isReportArchived,
policyForMovingExpensesID,
reportMetadata: itemReportMetadata,
visibleReportActionsDataParam: visibleReportActionsData,
lastAction,
});

let lastAction: ReportAction | undefined;
if (!itemReportActions || !item) {
lastAction = undefined;
} else {
const canUserPerformWriteAction = canUserPerformWriteActionUtil(item, isReportArchived);
const actionsArray = getSortedReportActions(Object.values(itemReportActions));
const reportActionsForDisplay = actionsArray.filter(
(reportAction) => shouldReportActionBeVisibleAsLastAction(reportAction, canUserPerformWriteAction) && reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.CREATED,
);
lastAction = reportActionsForDisplay.at(-1);
}
const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === reportID;

let lastActionReport: OnyxEntry<Report> | undefined;
if (isInviteOrRemovedAction(lastAction)) {
Expand Down Expand Up @@ -327,6 +326,7 @@
isScreenFocused,
localeCompare,
translate,
visibleReportActionsData,
currentUserAccountID,
],
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/LHNOptionsList/OptionRowLHNData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function OptionRowLHNData({

const [movedFromReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.FROM)}`, {canBeMissing: true});
const [movedToReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.TO)}`, {canBeMissing: true});
const [visibleReportActionsData] = useOnyx(ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS, {canBeMissing: true});
// Check the report errors equality to avoid re-rendering when there are no changes
const prevReportErrors = usePrevious(reportAttributes?.reportErrors);
const areReportErrorsEqual = useMemo(() => deepEqual(prevReportErrors, reportAttributes?.reportErrors), [prevReportErrors, reportAttributes?.reportErrors]);
Expand Down Expand Up @@ -78,6 +79,7 @@ function OptionRowLHNData({
movedFromReport,
movedToReport,
currentUserAccountID,
visibleReportActionsData,
});
if (deepEqual(item, optionItemRef.current)) {
return optionItemRef.current;
Expand Down Expand Up @@ -114,6 +116,7 @@ function OptionRowLHNData({
movedFromReport,
movedToReport,
currentUserAccountID,
visibleReportActionsData,
]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ import {
getMostRecentIOURequestActionID,
getOneTransactionThreadReportID,
hasNextActionMadeBySameActor,
isActionableWhisperRequiringWritePermission,
isConsecutiveChronosAutomaticTimerAction,
isCurrentActionUnread,
isDeletedParentAction,
isIOUActionMatchingTransactionList,
shouldReportActionBeVisible,
wasMessageReceivedWhileOffline,
} from '@libs/ReportActionsUtils';
import {canUserPerformWriteAction, chatIncludesChronosWithID, getOriginalReportID, getReportLastVisibleActionCreated, isHarvestCreatedExpenseReport, isUnread} from '@libs/ReportUtils';
Expand Down Expand Up @@ -171,6 +171,7 @@ function MoneyRequestReportActionsList({

const isReportArchived = useReportIsArchived(reportID);
const canPerformWriteAction = canUserPerformWriteAction(report, isReportArchived);
const [visibleReportActionsData] = useOnyx(ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS, {canBeMissing: true});

const {shouldUseNarrowLayout} = useResponsiveLayoutOnWideRHP();

Expand Down Expand Up @@ -225,17 +226,34 @@ function MoneyRequestReportActionsList({
const visibleReportActions = useMemo(() => {
const filteredActions = reportActions.filter((reportAction) => {
const isActionVisibleOnMoneyReport = isActionVisibleOnMoneyRequestReport(reportAction, shouldShowHarvestCreatedAction);
if (!isActionVisibleOnMoneyReport) {
return false;
}

return (
isActionVisibleOnMoneyReport &&
(isOffline || isDeletedParentAction(reportAction) || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors) &&
shouldReportActionBeVisible(reportAction, reportAction.reportActionID, canPerformWriteAction) &&
isIOUActionMatchingTransactionList(reportAction, reportTransactionIDs)
);
const passesOfflineCheck = isOffline || isDeletedParentAction(reportAction) || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors;
if (!passesOfflineCheck) {
return false;
}

const actionReportID = reportAction.reportID ?? reportID;
const isStaticallyVisible = visibleReportActionsData?.[actionReportID]?.[reportAction.reportActionID] ?? true;
if (!isStaticallyVisible) {
return false;
}

if (!canPerformWriteAction && isActionableWhisperRequiringWritePermission(reportAction)) {
return false;
}

if (!isIOUActionMatchingTransactionList(reportAction, reportTransactionIDs)) {
return false;
}

return true;
});

return filteredActions.toReversed();
}, [reportActions, isOffline, canPerformWriteAction, reportTransactionIDs, shouldShowHarvestCreatedAction]);
}, [reportActions, isOffline, canPerformWriteAction, reportTransactionIDs, shouldShowHarvestCreatedAction, visibleReportActionsData, reportID]);

const reportActionSize = useRef(visibleReportActions.length);
const lastAction = visibleReportActions.at(-1);
Expand Down
5 changes: 3 additions & 2 deletions src/components/ParentNavigationSubtitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import {isFullScreenName} from '@libs/Navigation/helpers/isNavigatorName';
import Navigation from '@libs/Navigation/Navigation';
import type {RightModalNavigatorParamList} from '@libs/Navigation/types';
import {getReportAction, shouldReportActionBeVisible} from '@libs/ReportActionsUtils';
import {getReportAction, isReportActionVisible} from '@libs/ReportActionsUtils';
import {canUserPerformWriteAction as canUserPerformWriteActionReportUtils, isMoneyRequestReport} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import type {ParentNavigationSummaryParams} from '@src/languages/params';
Expand Down Expand Up @@ -88,6 +88,7 @@ function ParentNavigationSubtitle({
const {translate} = useLocalize();
const [currentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: false});
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`, {canBeMissing: false});
const [visibleReportActionsData] = useOnyx(ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS, {canBeMissing: true});
const isReportArchived = useReportIsArchived(report?.reportID);
const canUserPerformWriteAction = canUserPerformWriteActionReportUtils(report, isReportArchived);
const isReportInRHP = currentRoute.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT;
Expand Down Expand Up @@ -116,7 +117,7 @@ function ParentNavigationSubtitle({

const onPress = () => {
const parentAction = getReportAction(parentReportID, parentReportActionID);
const isVisibleAction = shouldReportActionBeVisible(parentAction, parentAction?.reportActionID ?? CONST.DEFAULT_NUMBER_ID, canUserPerformWriteAction);
const isVisibleAction = isReportActionVisible(parentAction, parentReportID, canUserPerformWriteAction, visibleReportActionsData);

const focusedNavigatorState = currentFocusedNavigator?.state;
const currentReportIndex = focusedNavigatorState?.index;
Expand Down
Loading
Loading