Skip to content

Commit 273cb25

Browse files
committed
Remove empty config objects from useOnyx
1 parent 445848a commit 273cb25

839 files changed

Lines changed: 2429 additions & 2429 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Expensify.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,24 @@ function Expensify() {
9898
const {setSplashScreenState} = useSplashScreenActions();
9999
const [hasAttemptedToOpenPublicRoom, setAttemptedToOpenPublicRoom] = useState(false);
100100
const {translate, preferredLocale} = useLocalize();
101-
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {});
102-
const [session, sessionMetadata] = useOnyx(ONYXKEYS.SESSION, {});
103-
const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE, {});
104-
const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA, {});
101+
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
102+
const [session, sessionMetadata] = useOnyx(ONYXKEYS.SESSION);
103+
const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE);
104+
const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA);
105105
const [isCheckingPublicRoom = true] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false});
106106
const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false});
107107
const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false});
108-
const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED, {});
109-
const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST, {});
110-
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {});
111-
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {});
112-
const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP, {});
113-
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {});
108+
const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED);
109+
const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST);
110+
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH);
111+
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
112+
const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP);
113+
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
114114
const {isOffline} = useNetwork();
115-
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS, {});
116-
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION, {});
117-
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {});
118-
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID, {});
115+
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS);
116+
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION);
117+
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
118+
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
119119

120120
useDebugShortcut();
121121
usePriorityMode();

src/HybridAppHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import isLoadingOnyxValue from './types/utils/isLoadingOnyxValue';
1414
function HybridAppHandler() {
1515
const {splashScreenState} = useSplashScreenState();
1616
const {setSplashScreenState} = useSplashScreenActions();
17-
const [tryNewDot, tryNewDotMetadata] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {});
17+
const [tryNewDot, tryNewDotMetadata] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
1818
const isLoadingTryNewDot = isLoadingOnyxValue(tryNewDotMetadata);
1919

2020
const finalizeTransitionFromOldDot = useCallback(

src/components/AccountSwitcher.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) {
4747
const {localeCompare, translate, formatPhoneNumber} = useLocalize();
4848
const {isOffline} = useNetwork();
4949
const {shouldUseNarrowLayout} = useResponsiveLayout();
50-
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {});
50+
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
5151
const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector});
52-
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {});
53-
const [credentials] = useOnyx(ONYXKEYS.CREDENTIALS, {});
54-
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS, {});
55-
const [session] = useOnyx(ONYXKEYS.SESSION, {});
56-
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION, {});
57-
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {});
52+
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED);
53+
const [credentials] = useOnyx(ONYXKEYS.CREDENTIALS);
54+
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS);
55+
const [session] = useOnyx(ONYXKEYS.SESSION);
56+
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION);
57+
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
5858

5959
const buttonRef = useRef<HTMLDivElement>(null);
6060
const {windowHeight} = useWindowDimensions();

src/components/AddPaymentCard/PaymentCardForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function PaymentCardForm({
126126
currencySelectorRoute,
127127
}: PaymentCardFormProps) {
128128
const styles = useThemeStyles();
129-
const [data, metadata] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM, {});
129+
const [data, metadata] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM);
130130

131131
const {translate} = useLocalize();
132132
const route = useRoute();

src/components/AddPaymentMethodMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ function AddPaymentMethodMenu({
6060
const icons = useMemoizedLazyExpensifyIcons(['Building', 'Bank']);
6161
const {translate} = useLocalize();
6262
const [restoreFocusType, setRestoreFocusType] = useState<BaseModalProps['restoreFocusType']>();
63-
const [session] = useOnyx(ONYXKEYS.SESSION, {});
64-
const [introSelected, introSelectedStatus] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {});
63+
const [session] = useOnyx(ONYXKEYS.SESSION);
64+
const [introSelected, introSelectedStatus] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
6565

6666
// Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report
6767
// which then starts a bottom up flow and creates a Collect workspace where the payer is an admin and payee is an employee.

src/components/AddPlaidBankAccount.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function AddPlaidBankAccount({
8383
const previousNetworkState = useRef<boolean | undefined>(undefined);
8484
const [selectedPlaidAccountMask, setSelectedPlaidAccountMask] = useState(defaultSelectedPlaidAccountMask);
8585
const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN, {initWithStoredValues: false});
86-
const [isPlaidDisabled] = useOnyx(ONYXKEYS.IS_PLAID_DISABLED, {});
86+
const [isPlaidDisabled] = useOnyx(ONYXKEYS.IS_PLAID_DISABLED);
8787
const {translate} = useLocalize();
8888
const {isOffline} = useNetwork();
8989

src/components/AddUnreportedExpenseFooter.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ function AddUnreportedExpenseFooter({selectedIds, report, reportToConfirm, repor
4242
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
4343
const session = useSession();
4444
const personalDetails = usePersonalDetails();
45-
const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {});
46-
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {});
47-
const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES, {});
48-
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {});
49-
const [betas] = useOnyx(ONYXKEYS.BETAS, {});
50-
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`, {});
45+
const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION);
46+
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
47+
const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES);
48+
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
49+
const [betas] = useOnyx(ONYXKEYS.BETAS);
50+
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`);
5151

5252
const handleConfirm = () => {
5353
if (selectedIds.size === 0) {

src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP
2828
const sourceURLWithAuth = addEncryptedAuthTokenToURL(source);
2929
const sourceID = (source.match(CONST.REGEX.ATTACHMENT_ID) ?? [])[1];
3030

31-
const [download] = useOnyx(`${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}`, {});
31+
const [download] = useOnyx(`${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}`);
3232
const {translate} = useLocalize();
3333

3434
const {isOffline} = useNetwork();

src/components/ApproverSelectionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function ApproverSelectionList({
7171
const styles = useThemeStyles();
7272
const {translate, localeCompare} = useLocalize();
7373
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');
74-
const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE, {});
74+
const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE);
7575
const shouldShowTextInput = shouldShowTextInputProp ?? allApprovers?.length >= CONST.STANDARD_LIST_ITEM_LIMIT;
7676
const lazyIllustrations = useMemoizedLazyIllustrations(['TurtleInShell']);
7777

src/components/ArchivedReportFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function ArchivedReportFooter({report, currentUserAccountID}: ArchivedReportFoot
2424
const styles = useThemeStyles();
2525
const {translate} = useLocalize();
2626

27-
const [personalDetails = getEmptyObject<PersonalDetailsList>()] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {});
27+
const [personalDetails = getEmptyObject<PersonalDetailsList>()] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
2828
const [reportClosedAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {canEvict: false, selector: getLastClosedReportAction});
2929
const originalMessage = isClosedAction(reportClosedAction) ? getOriginalMessage(reportClosedAction) : null;
3030
const archiveReason = originalMessage?.reason ?? CONST.REPORT.ARCHIVE_REASON.DEFAULT;

0 commit comments

Comments
 (0)