Skip to content

Commit 445848a

Browse files
committed
Remove canBeMissing from TS files
1 parent 127a4b7 commit 445848a

908 files changed

Lines changed: 2661 additions & 2955 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: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ import {hasAuthToken} from './libs/actions/Session';
3333
import * as User from './libs/actions/User';
3434
import * as ActiveClientManager from './libs/ActiveClientManager';
3535
import {isSafari} from './libs/Browser';
36-
import * as Environment from './libs/Environment/Environment';
3736
import FS from './libs/Fullstory';
38-
import Growl, {growlRef} from './libs/Growl';
37+
import {growlRef} from './libs/Growl';
3938
import Log from './libs/Log';
4039
import migrateOnyx from './libs/migrateOnyx';
4140
import Navigation from './libs/Navigation/Navigation';
@@ -62,13 +61,6 @@ Onyx.registerLogger(({level, message, parameters}) => {
6261
if (level === 'alert') {
6362
Log.alert(message, parameters);
6463
console.error(message);
65-
66-
// useOnyx() calls with "canBeMissing" config set to false will display a visual alert in dev environment
67-
// when they don't return data.
68-
const shouldShowAlert = typeof parameters === 'object' && !Array.isArray(parameters) && 'showAlert' in parameters && 'key' in parameters;
69-
if (Environment.isDevelopment() && shouldShowAlert) {
70-
Growl.error(`${message} Key: ${parameters.key as string}`, 10000);
71-
}
7264
} else if (level === 'hmmm') {
7365
Log.hmmm(message, parameters);
7466
} else {
@@ -106,24 +98,24 @@ function Expensify() {
10698
const {setSplashScreenState} = useSplashScreenActions();
10799
const [hasAttemptedToOpenPublicRoom, setAttemptedToOpenPublicRoom] = useState(false);
108100
const {translate, preferredLocale} = useLocalize();
109-
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});
110-
const [session, sessionMetadata] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true});
111-
const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE, {canBeMissing: true});
112-
const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA, {canBeMissing: true});
113-
const [isCheckingPublicRoom = true] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false, canBeMissing: true});
114-
const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false, canBeMissing: true});
115-
const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false, canBeMissing: true});
116-
const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED, {canBeMissing: true});
117-
const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST, {canBeMissing: true});
118-
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: true});
119-
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
120-
const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP, {canBeMissing: true});
121-
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true});
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, {});
105+
const [isCheckingPublicRoom = true] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false});
106+
const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false});
107+
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, {});
122114
const {isOffline} = useNetwork();
123-
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS, {canBeMissing: true});
124-
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION, {canBeMissing: true});
125-
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
126-
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID, {canBeMissing: true});
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, {});
127119

128120
useDebugShortcut();
129121
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, {canBeMissing: true});
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: 8 additions & 8 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, {canBeMissing: true});
51-
const [accountID] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: accountIDSelector});
52-
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
53-
const [credentials] = useOnyx(ONYXKEYS.CREDENTIALS, {canBeMissing: true});
54-
const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS, {canBeMissing: true});
55-
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true});
56-
const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION, {canBeMissing: true});
57-
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true});
50+
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {});
51+
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, {});
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, {canBeMissing: true});
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, {canBeMissing: true});
64-
const [introSelected, introSelectedStatus] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ function AddPlaidBankAccount({
8282
const subscribedKeyboardShortcuts = useRef<Array<() => void>>([]);
8383
const previousNetworkState = useRef<boolean | undefined>(undefined);
8484
const [selectedPlaidAccountMask, setSelectedPlaidAccountMask] = useState(defaultSelectedPlaidAccountMask);
85-
const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN, {canBeMissing: true, initWithStoredValues: false});
86-
const [isPlaidDisabled] = useOnyx(ONYXKEYS.IS_PLAID_DISABLED, {canBeMissing: true});
85+
const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN, {initWithStoredValues: false});
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, {canBeMissing: true});
46-
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true});
47-
const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES, {canBeMissing: true});
48-
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
49-
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true});
50-
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`, {canBeMissing: true});
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}`, {canBeMissing: true});
31+
const [download] = useOnyx(`${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}`, {});
3232
const {translate} = useLocalize();
3333

3434
const {isOffline} = useNetwork();

src/components/ApprovalWorkflowSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function ApprovalWorkflowSection({approvalWorkflow, onPress, currency = CONST.CU
3636
const {translate, toLocaleOrdinal, localeCompare} = useLocalize();
3737
const {shouldUseNarrowLayout} = useResponsiveLayout();
3838
const [personalDetailsByEmail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
39-
canBeMissing: true,
4039
selector: personalDetailsByEmailSelector,
4140
});
4241

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, {canBeMissing: false});
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

0 commit comments

Comments
 (0)