Skip to content

Commit 5be1876

Browse files
committed
prettier & eslint
1 parent 717fabd commit 5be1876

9 files changed

Lines changed: 22 additions & 23 deletions

src/components/MoneyReportHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import {ActivityIndicator, InteractionManager, View} from 'react-native';
44
import type {OnyxEntry} from 'react-native-onyx';
55
import {useOnyx} from 'react-native-onyx';
66
import type {ValueOf} from 'type-fest';
7-
import useReportDataLoading from '@hooks/useReportDataLoading';
87
import useLocalize from '@hooks/useLocalize';
98
import useMobileSelectionMode from '@hooks/useMobileSelectionMode';
109
import useNetwork from '@hooks/useNetwork';
1110
import usePaymentAnimations from '@hooks/usePaymentAnimations';
1211
import usePaymentOptions from '@hooks/usePaymentOptions';
1312
import usePermissions from '@hooks/usePermissions';
13+
import useReportDataLoading from '@hooks/useReportDataLoading';
1414
import useReportIsArchived from '@hooks/useReportIsArchived';
1515
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1616
import useSelectedTransactionsActions from '@hooks/useSelectedTransactionsActions';

src/components/MoneyRequestHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {View} from 'react-native';
55
import type {OnyxEntry} from 'react-native-onyx';
66
import {useOnyx} from 'react-native-onyx';
77
import type {ValueOf} from 'type-fest';
8-
import useReportDataLoading from '@hooks/useReportDataLoading';
98
import useLocalize from '@hooks/useLocalize';
109
import usePermissions from '@hooks/usePermissions';
10+
import useReportDataLoading from '@hooks/useReportDataLoading';
1111
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1212
import useTheme from '@hooks/useTheme';
1313
import useThemeStyles from '@hooks/useThemeStyles';

src/components/Navigation/TopBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {PressableWithoutFeedback} from '@components/Pressable';
66
import SearchButton from '@components/Search/SearchRouter/SearchButton';
77
import HelpButton from '@components/SidePanel/HelpComponents/HelpButton';
88
import Text from '@components/Text';
9-
import useReportDataLoading from '@hooks/useReportDataLoading';
109
import useLocalize from '@hooks/useLocalize';
10+
import useReportDataLoading from '@hooks/useReportDataLoading';
1111
import useThemeStyles from '@hooks/useThemeStyles';
1212
import SignInButton from '@pages/home/sidebar/SignInButton';
1313
import {isAnonymousUser as isAnonymousUserUtil} from '@userActions/Session';

src/components/PriorityModeController.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {useNavigation} from '@react-navigation/native';
22
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
33
import {useOnyx} from 'react-native-onyx';
4+
import useReportDataLoading from '@hooks/useReportDataLoading';
45
import {updateChatPriorityMode} from '@libs/actions/User';
56
import getIsNarrowLayout from '@libs/getIsNarrowLayout';
67
import Log from '@libs/Log';
78
import navigationRef from '@libs/Navigation/navigationRef';
89
import {isReportParticipant, isValidReport} from '@libs/ReportUtils';
9-
import useReportDataLoading from '@hooks/useReportDataLoading';
1010
import CONST from '@src/CONST';
1111
import ONYXKEYS from '@src/ONYXKEYS';
1212
import SCREENS from '@src/SCREENS';

src/hooks/useReportDataLoading.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@ const RELEVANT_COMMANDS = new Set<string>([WRITE_COMMANDS.OPEN_APP, WRITE_COMMAN
77

88
/**
99
* Hook that determines if report data is currently being loaded
10-
*
10+
*
1111
* Monitors persisted requests queue for OpenApp, ReconnectApp, and OpenReport commands
1212
* that trigger report data fetching from the server.
13-
*
13+
*
1414
* @param respectOfflineState - If true (default), won't show loading when offline (for loading bars).
1515
* If false, shows loading regardless of offline state (for full-screen loading).
1616
*/
1717
export default function useReportDataLoading(respectOfflineState = true): boolean {
1818
const [req] = useOnyx(ONYXKEYS.PERSISTED_REQUESTS, {canBeMissing: false});
1919
const [network] = useOnyx(ONYXKEYS.NETWORK, {canBeMissing: false});
2020

21-
const hasRelevantRequests = req?.some((request) =>
22-
RELEVANT_COMMANDS.has(request.command) && !request.initiatedOffline
23-
) ?? false;
21+
const hasRelevantRequests = req?.some((request) => RELEVANT_COMMANDS.has(request.command) && !request.initiatedOffline) ?? false;
2422

2523
// For loading bars, respect offline state (don't show when offline)
2624
// For full-screen loading, ignore offline state
@@ -29,4 +27,4 @@ export default function useReportDataLoading(respectOfflineState = true): boolea
2927
}
3028

3129
return hasRelevantRequests;
32-
}
30+
}

src/pages/home/HeaderView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import TaskHeaderActionButton from '@components/TaskHeaderActionButton';
2424
import Text from '@components/Text';
2525
import Tooltip from '@components/Tooltip';
2626
import useHasTeam2025Pricing from '@hooks/useHasTeam2025Pricing';
27-
import useReportDataLoading from '@hooks/useReportDataLoading';
2827
import useLocalize from '@hooks/useLocalize';
2928
import usePolicy from '@hooks/usePolicy';
29+
import useReportDataLoading from '@hooks/useReportDataLoading';
3030
import useResponsiveLayout from '@hooks/useResponsiveLayout';
3131
import useSubscriptionPlan from '@hooks/useSubscriptionPlan';
3232
import useTheme from '@hooks/useTheme';

src/pages/home/report/withReportAndReportActionOrNotFound.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ export default function <TProps extends WithReportAndReportActionOrNotFoundProps
3939
WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>,
4040
): ComponentType<TProps & RefAttributes<TRef>> {
4141
function WithReportOrNotFound(props: TProps, ref: ForwardedRef<TRef>) {
42-
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`);
42+
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`, {canBeMissing: true});
4343
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
44-
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || CONST.DEFAULT_NUMBER_ID}`);
45-
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`);
44+
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`, {canBeMissing: true});
45+
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`, {canBeMissing: true});
4646
const isLoadingReportData = useReportDataLoading(false);
47-
const [betas] = useOnyx(ONYXKEYS.BETAS);
48-
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
49-
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`, {canEvict: false});
47+
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: false});
48+
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
49+
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`, {canEvict: false, canBeMissing: true});
5050
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
51-
const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID || CONST.DEFAULT_NUMBER_ID}`, {
51+
const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`, {
5252
selector: (parentReportActions) => {
5353
const parentReportActionID = report?.parentReportActionID;
5454
if (!parentReportActionID) {
@@ -57,6 +57,7 @@ export default function <TProps extends WithReportAndReportActionOrNotFoundProps
5757
return parentReportActions?.[parentReportActionID] ?? null;
5858
},
5959
canEvict: false,
60+
canBeMissing: true,
6061
});
6162
const linkedReportAction = useMemo(() => {
6263
let reportAction: OnyxEntry<OnyxTypes.ReportAction> = reportActions?.[`${props.route.params.reportActionID}`];

src/pages/home/report/withReportOrNotFound.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ export default function (
6464
): <TProps extends WithReportOrNotFoundProps, TRef>(WrappedComponent: React.ComponentType<TProps & React.RefAttributes<TRef>>) => React.ComponentType<TProps & React.RefAttributes<TRef>> {
6565
return function <TProps extends WithReportOrNotFoundProps, TRef>(WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>) {
6666
function WithReportOrNotFound(props: TProps, ref: ForwardedRef<TRef>) {
67-
const [betas] = useOnyx(ONYXKEYS.BETAS);
68-
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
69-
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`);
67+
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: false});
68+
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
69+
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`, {canBeMissing: true});
7070
const isLoadingReportData = useReportDataLoading(false);
71-
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`);
71+
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`, {canBeMissing: true});
7272
const isFocused = useIsFocused();
7373
const contentShown = React.useRef(false);
7474
const isReportIdInRoute = !!props.route.params.reportID?.length;

src/pages/workspace/withPolicyAndFullscreenLoading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function withPolicyAndFullscreenLoading<TProps extends WithPolicy
3737
ref: ForwardedRef<TRef>,
3838
) {
3939
const isLoadingReportData = useReportDataLoading(false);
40-
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
40+
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
4141

4242
if ((isLoadingPolicy || isLoadingReportData) && isEmpty(policy) && isEmpty(policyDraft)) {
4343
return <FullscreenLoadingIndicator />;

0 commit comments

Comments
 (0)