@@ -7,18 +7,19 @@ import * as Expensicons from '@components/Icon/Expensicons';
7
7
import ScreenWrapper from '@components/ScreenWrapper' ;
8
8
import Text from '@components/Text' ;
9
9
import useLocalize from '@hooks/useLocalize' ;
10
+ import useReportIsArchived from '@hooks/useReportIsArchived' ;
10
11
import useStyleUtils from '@hooks/useStyleUtils' ;
11
12
import useTheme from '@hooks/useTheme' ;
12
13
import useThemeStyles from '@hooks/useThemeStyles' ;
13
14
import { navigateToConciergeChatAndDeleteReport } from '@libs/actions/Report' ;
14
15
import DebugUtils from '@libs/DebugUtils' ;
15
- import * as DeviceCapabilities from '@libs/DeviceCapabilities' ;
16
+ import { canUseTouchScreen } from '@libs/DeviceCapabilities' ;
16
17
import type { DebugTabNavigatorRoutes } from '@libs/Navigation/DebugTabNavigator' ;
17
18
import DebugTabNavigator from '@libs/Navigation/DebugTabNavigator' ;
18
19
import Navigation from '@libs/Navigation/Navigation' ;
19
20
import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
20
21
import type { DebugParamList } from '@libs/Navigation/types' ;
21
- import * as ReportUtils from '@libs/ReportUtils' ;
22
+ import { hasReportViolations , isReportOwner , shouldDisplayViolationsRBRInLHN } from '@libs/ReportUtils' ;
22
23
import DebugDetails from '@pages/Debug/DebugDetails' ;
23
24
import DebugJSON from '@pages/Debug/DebugJSON' ;
24
25
import NotFoundPage from '@pages/ErrorPage/NotFoundPage' ;
@@ -50,21 +51,22 @@ function DebugReportPage({
50
51
const styles = useThemeStyles ( ) ;
51
52
const StyleUtils = useStyleUtils ( ) ;
52
53
const theme = useTheme ( ) ;
53
- const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` ) ;
54
- const [ reportActions ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ) ;
55
- const [ transactionViolations ] = useOnyx ( ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS ) ;
54
+ const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` , { canBeMissing : true } ) ;
55
+ const [ reportActions ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` , { canBeMissing : true } ) ;
56
+ const [ transactionViolations ] = useOnyx ( ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS , { canBeMissing : true } ) ;
56
57
const transactionID = DebugUtils . getTransactionID ( report , reportActions ) ;
58
+ const isReportArchived = useReportIsArchived ( reportID ) ;
57
59
58
60
const metadata = useMemo < Metadata [ ] > ( ( ) => {
59
61
if ( ! report ) {
60
62
return [ ] ;
61
63
}
62
64
63
- const shouldDisplayViolations = ReportUtils . shouldDisplayViolationsRBRInLHN ( report , transactionViolations ) ;
64
- const shouldDisplayReportViolations = ReportUtils . isReportOwner ( report ) && ReportUtils . hasReportViolations ( reportID ) ;
65
+ const shouldDisplayViolations = shouldDisplayViolationsRBRInLHN ( report , transactionViolations ) ;
66
+ const shouldDisplayReportViolations = isReportOwner ( report ) && hasReportViolations ( reportID ) ;
65
67
const hasViolations = ! ! shouldDisplayViolations || shouldDisplayReportViolations ;
66
68
const { reason : reasonGBR , reportAction : reportActionGBR } = DebugUtils . getReasonAndReportActionForGBRInLHNRow ( report ) ?? { } ;
67
- const { reason : reasonRBR , reportAction : reportActionRBR } = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( report , reportActions , hasViolations ) ?? { } ;
69
+ const { reason : reasonRBR , reportAction : reportActionRBR } = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( report , reportActions , hasViolations , isReportArchived ) ?? { } ;
68
70
const hasRBR = ! ! reasonRBR ;
69
71
const hasGBR = ! hasRBR && ! ! reasonGBR ;
70
72
const reasonLHN = DebugUtils . getReasonForShowingRowInLHN ( report , hasRBR ) ;
@@ -112,7 +114,7 @@ function DebugReportPage({
112
114
: undefined ,
113
115
} ,
114
116
] ;
115
- } , [ report , reportActions , reportID , transactionViolations , translate ] ) ;
117
+ } , [ report , reportActions , reportID , transactionViolations , translate , isReportArchived ] ) ;
116
118
117
119
const DebugDetailsTab = useCallback (
118
120
( ) => (
@@ -213,7 +215,7 @@ function DebugReportPage({
213
215
< ScreenWrapper
214
216
includeSafeAreaPaddingBottom = { false }
215
217
shouldEnableKeyboardAvoidingView = { false }
216
- shouldEnableMinHeight = { DeviceCapabilities . canUseTouchScreen ( ) }
218
+ shouldEnableMinHeight = { canUseTouchScreen ( ) }
217
219
testID = { DebugReportPage . displayName }
218
220
>
219
221
{ ( { safeAreaPaddingBottomStyle} ) => (
0 commit comments