Skip to content

Commit dd58318

Browse files
committed
Add canBeMissing param
1 parent f18e704 commit dd58318

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/components/Search/SearchAutocompleteList.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ function SearchAutocompleteList(
146146

147147
const {activeWorkspaceID} = useActiveWorkspace();
148148
const policy = usePolicy(activeWorkspaceID);
149-
const [betas] = useOnyx(ONYXKEYS.BETAS);
150-
const [recentSearches] = useOnyx(ONYXKEYS.RECENT_SEARCHES);
149+
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true});
150+
const [recentSearches] = useOnyx(ONYXKEYS.RECENT_SEARCHES, {canBeMissing: true});
151151
const personalDetails = usePersonalDetails();
152-
const [reports = {}] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
152+
const [reports = {}] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
153153
const taxRates = getAllTaxRates();
154154
const {canUseLeftHandBar} = usePermissions();
155155

@@ -169,8 +169,8 @@ function SearchAutocompleteList(
169169
const expenseTypes = Object.values(CONST.SEARCH.TRANSACTION_TYPE);
170170
const booleanTypes = Object.values(CONST.SEARCH.BOOLEAN);
171171

172-
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST);
173-
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST);
172+
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
173+
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: true});
174174
const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList), [userCardList, workspaceCardFeeds]);
175175
const cardAutocompleteList = Object.values(allCards);
176176
const cardFeedNamesWithType = useMemo(() => {
@@ -212,27 +212,27 @@ function SearchAutocompleteList(
212212

213213
const taxAutocompleteList = useMemo(() => getAutocompleteTaxList(taxRates, policy), [policy, taxRates]);
214214

215-
const [allPolicyCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_CATEGORIES);
216-
const [allRecentCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES);
215+
const [allPolicyCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_CATEGORIES, {canBeMissing: false});
216+
const [allRecentCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {canBeMissing: true});
217217
const categoryAutocompleteList = useMemo(() => {
218218
return getAutocompleteCategories(allPolicyCategories, activeWorkspaceID);
219219
}, [activeWorkspaceID, allPolicyCategories]);
220220
const recentCategoriesAutocompleteList = useMemo(() => {
221221
return getAutocompleteRecentCategories(allRecentCategories, activeWorkspaceID);
222222
}, [activeWorkspaceID, allRecentCategories]);
223223

224-
const [policies = {}] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
225-
const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email});
224+
const [policies = {}] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
225+
const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email, canBeMissing: false});
226226

227227
const workspaceList = Object.values(policies)
228228
.filter((singlePolicy) => !!singlePolicy && shouldShowPolicy(singlePolicy, false, currentUserLogin) && !singlePolicy?.isJoinRequestPending)
229229
.map((singlePolicy) => ({id: singlePolicy?.id, name: singlePolicy?.name ?? ''}));
230230

231-
const [currencyList] = useOnyx(ONYXKEYS.CURRENCY_LIST);
231+
const [currencyList] = useOnyx(ONYXKEYS.CURRENCY_LIST, {canBeMissing: false});
232232
const currencyAutocompleteList = Object.keys(currencyList ?? {}).filter((currency) => !currencyList?.[currency]?.retired);
233-
const [recentCurrencyAutocompleteList] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES);
234-
const [allPoliciesTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS);
235-
const [allRecentTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS);
233+
const [recentCurrencyAutocompleteList] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES, {canBeMissing: true});
234+
const [allPoliciesTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {canBeMissing: false});
235+
const [allRecentTags] = useOnyx(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS, {canBeMissing: true});
236236
const tagAutocompleteList = useMemo(() => {
237237
return getAutocompleteTags(allPoliciesTags, activeWorkspaceID);
238238
}, [activeWorkspaceID, allPoliciesTags]);

src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
6969
const theme = useTheme();
7070
const {shouldUseNarrowLayout: displayNarrowHeader} = useResponsiveLayout();
7171
const personalDetails = usePersonalDetails();
72-
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
73-
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
72+
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
73+
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
7474
const taxRates = useMemo(() => getAllTaxRates(), []);
75-
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST);
76-
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST);
75+
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
76+
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: true});
7777
const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList), [userCardList, workspaceCardFeeds]);
7878
const cardFeedNamesWithType = useMemo(() => {
7979
return getCardFeedNamesWithType({workspaceCardFeeds, translate});

src/components/Search/SearchRouter/SearchRouter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ type SearchRouterProps = {
8080
function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDisplayed}: SearchRouterProps, ref: React.Ref<View>) {
8181
const {translate} = useLocalize();
8282
const styles = useThemeStyles();
83-
const [, recentSearchesMetadata] = useOnyx(ONYXKEYS.RECENT_SEARCHES);
84-
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
83+
const [, recentSearchesMetadata] = useOnyx(ONYXKEYS.RECENT_SEARCHES, {canBeMissing: true});
84+
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false, canBeMissing: true});
8585
const {activeWorkspaceID} = useActiveWorkspace();
8686
const {canUseLeftHandBar} = usePermissions();
8787

0 commit comments

Comments
 (0)