Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ function MoneyReportHeader({
offset: 0,
queryJSON: currentSearchQueryJSON,
isOffline,
isLoading: !!currentSearchResults?.search.isLoading,
isLoading: !!currentSearchResults?.search?.isLoading,
});
}
}
Expand All @@ -507,7 +507,7 @@ function MoneyReportHeader({
currentSearchQueryJSON,
currentSearchKey,
isOffline,
currentSearchResults?.search.isLoading,
currentSearchResults?.search?.isLoading,
],
);

Expand Down Expand Up @@ -799,7 +799,7 @@ function MoneyReportHeader({
offset: 0,
queryJSON: currentSearchQueryJSON,
isOffline,
isLoading: !!currentSearchResults?.search.isLoading,
isLoading: !!currentSearchResults?.search?.isLoading,
});
}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function MoneyRequestReportNavigation({reportID, shouldDisplayNarrowVersion}: Mo
prevReportsLength: allReports.length,
shouldCalculateTotals: false,
searchKey: lastSearchQuery.searchKey,
isLoading: !!currentSearchResults?.search.isLoading,
isLoading: !!currentSearchResults?.search?.isLoading,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ function Search({
return;
}

handleSearch({queryJSON, searchKey, offset, shouldCalculateTotals, prevReportsLength: filteredDataLength, isLoading: !!searchResults?.search.isLoading});
handleSearch({queryJSON, searchKey, offset, shouldCalculateTotals, prevReportsLength: filteredDataLength, isLoading: !!searchResults?.search?.isLoading});

// We don't need to run the effect on change of isFocused.
// eslint-disable-next-line react-compiler/react-compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ function TransactionGroupListItem<TItem extends ListItem>({
searchKey: undefined,
offset: (transactionsSnapshot?.search?.offset ?? 0) + pageSize,
shouldCalculateTotals: false,
isLoading: !!transactionsSnapshot?.search.isLoading,
isLoading: !!transactionsSnapshot?.search?.isLoading,
});
},
[groupItem.transactionsQueryJSON, transactionsSnapshot?.search?.offset, transactionsSnapshot?.search.isLoading],
[groupItem.transactionsQueryJSON, transactionsSnapshot?.search?.offset, transactionsSnapshot?.search?.isLoading],
);

const animatedHighlightStyle = useAnimatedHighlightStyle({
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useSearchHighlightAndScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function useSearchHighlightAndScroll({
// Trigger the search
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
search({queryJSON, searchKey, offset, shouldCalculateTotals, isLoading: !!searchResults?.search.isLoading});
search({queryJSON, searchKey, offset, shouldCalculateTotals, isLoading: !!searchResults?.search?.isLoading});
});

// Set the ref to prevent further triggers until reset
Expand All @@ -154,16 +154,16 @@ function useSearchHighlightAndScroll({
searchResults?.data,
existingSearchResultIDs,
isOffline,
searchResults?.search.isLoading,
searchResults?.search?.isLoading,
]);

useEffect(() => {
if (searchResults?.search.isLoading) {
if (searchResults?.search?.isLoading) {
return;
}

searchTriggeredRef.current = false;
}, [searchResults?.search.isLoading]);
}, [searchResults?.search?.isLoading]);

// Initialize the set with existing IDs only once
useEffect(() => {
Expand Down
Loading