@@ -25,6 +25,7 @@ import Text from '@components/Text';
2525import Tooltip from '@components/Tooltip' ;
2626import useHasTeam2025Pricing from '@hooks/useHasTeam2025Pricing' ;
2727import useLocalize from '@hooks/useLocalize' ;
28+ import useNetwork from '@hooks/useNetwork' ;
2829import usePolicy from '@hooks/usePolicy' ;
2930import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
3031import useSubscriptionPlan from '@hooks/useSubscriptionPlan' ;
@@ -34,7 +35,7 @@ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
3435import Navigation from '@libs/Navigation/Navigation' ;
3536import { getPersonalDetailsForAccountIDs } from '@libs/OptionsListUtils' ;
3637import Parser from '@libs/Parser' ;
37- import { getOneTransactionThreadReportID , getReportActions } from '@libs/ReportActionsUtils' ;
38+ import { getOneTransactionThreadReportID , getReportActions , isMessageDeleted } from '@libs/ReportActionsUtils' ;
3839import {
3940 canJoinChat ,
4041 canUserPerformWriteAction ,
@@ -139,10 +140,19 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
139140 const isPolicyExpenseChat = isPolicyExpenseChatReportUtils ( report ) ;
140141 const isTaskReport = isTaskReportReportUtils ( report ) ;
141142 const [ parentOfParentReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ parentReport ?. parentReportID } ` , { canBeMissing : true } ) ;
143+ const { isOffline} = useNetwork ( ) ;
144+ const visibleParentOfParentReportActions = useMemo ( ( ) => {
145+ if ( ! parentOfParentReport ) {
146+ return ;
147+ }
148+
149+ const allReportActions = getReportActions ( parentOfParentReport ) ;
150+ return Object . values ( allReportActions ?? { } ) . filter ( ( action ) => ! isMessageDeleted ( action ) || ( action . pendingAction === CONST . RED_BRICK_ROAD_PENDING_ACTION . DELETE && isOffline ) ) ;
151+ } , [ parentOfParentReport , isOffline ] ) ;
142152 const reportHeaderData =
143153 ( ( ! isTaskReport && ! isChatThread ) ||
144154 ( parentOfParentReport &&
145- ! ! getOneTransactionThreadReportID ( parentOfParentReport , getReportOrDraftReport ( parentOfParentReport ?. chatReportID ) , getReportActions ( parentOfParentReport ) ) ) ) &&
155+ ! ! getOneTransactionThreadReportID ( parentOfParentReport , getReportOrDraftReport ( parentOfParentReport ?. chatReportID ) , visibleParentOfParentReportActions ) ) ) &&
146156 report ?. parentReportID
147157 ? parentReport
148158 : report ;
0 commit comments