Skip to content

Commit 74827ee

Browse files
committed
fix conflcits
1 parent 41387a1 commit 74827ee

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

Mobile-Expensify

src/components/Navigation/SearchSidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ function SearchSidebar({state}: SearchSidebarProps) {
5757
}
5858
}, [lastSearchType, queryJSON, setLastSearchType, currentSearchResults]);
5959

60-
const isDataLoaded = isSearchDataLoaded(currentSearchResults?.data ? currentSearchResults : lastNonEmptySearchResults, queryJSON);
60+
const searchResultsToUse = (currentSearchResults?.hasResults ?? currentSearchResults?.hasMoreResults) ? currentSearchResults : lastNonEmptySearchResults;
61+
62+
const isDataLoaded = isSearchDataLoaded(searchResultsToUse, queryJSON);
63+
6164
const shouldShowLoadingState = route?.name === SCREENS.SEARCH.MONEY_REQUEST_REPORT ? false : !isOffline && !isDataLoaded;
6265

6366
if (shouldUseNarrowLayout) {

src/components/Search/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function Search({queryJSON, searchResults, onSearchListScroll, contentContainerS
238238

239239
// There's a race condition in Onyx which makes it return data from the previous Search, so in addition to checking that the data is loaded
240240
// we also need to check that the searchResults matches the type and status of the current search
241-
const isDataLoaded = isSearchDataLoaded(searchResults?.search, queryJSON);
241+
const isDataLoaded = isSearchDataLoaded(searchResults?.search, queryJSON) ?? false;
242242

243243
const shouldShowLoadingState = !isOffline && (!isDataLoaded || (!!searchResults?.search.isLoading && Array.isArray(searchResults?.data) && searchResults?.data.length === 0));
244244
const shouldShowLoadingMoreItems = !shouldShowLoadingState && searchResults?.search?.isLoading && searchResults?.search?.offset > 0;

src/libs/SearchUIUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ function shouldShowEmptyState(isDataLoaded: boolean, dataLength: number, type: S
16471647
return !isDataLoaded || dataLength === 0 || !Object.values(CONST.SEARCH.DATA_TYPES).includes(type);
16481648
}
16491649

1650-
function isSearchDataLoaded(searchResults: SearchResults | undefined, queryJSON: SearchQueryJSON | undefined) {
1650+
function isSearchDataLoaded(searchResults: SearchResultsInfo | undefined, queryJSON: SearchQueryJSON | undefined) {
16511651
const {status} = queryJSON ?? {};
16521652

16531653
const isDataLoaded =

0 commit comments

Comments
 (0)