Skip to content

Commit 8095dd0

Browse files
authored
Merge pull request Expensify#89418 from Expensify/claude-hideFooterWhenAllMatchingSelected
Hide total footer when Select All Matching Items is active
2 parents c8af8b3 + b3f1699 commit 8095dd0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/pages/Search/SearchPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function SearchPage({route}: SearchPageProps) {
7777

7878
const metadata = searchResults?.search;
7979
const shouldAllowFooterTotals = useSearchShouldCalculateTotals(currentSearchKey, currentSearchQueryJSON?.hash, true);
80-
const shouldShowFooter = selectedTransactionsKeys.length > 0 || (shouldAllowFooterTotals && !!metadata?.count);
80+
const shouldShowFooter = (!areAllMatchingItemsSelected && selectedTransactionsKeys.length > 0) || (shouldAllowFooterTotals && !!metadata?.count);
8181

8282
useEffect(() => {
8383
if (shouldUseNarrowLayout) {
@@ -121,7 +121,7 @@ function SearchPage({route}: SearchPageProps) {
121121
return {count: undefined, total: undefined, currency: undefined};
122122
}
123123

124-
const shouldUseClientTotal = selectedTransactionsKeys.length > 0 || !metadata?.count || (selectedTransactionsKeys.length > 0 && !areAllMatchingItemsSelected);
124+
const shouldUseClientTotal = selectedTransactionsKeys.length > 0 || !metadata?.count;
125125
const selectedTransactionItems = Object.values(selectedTransactions);
126126
const currency = metadata?.currency ?? selectedTransactionItems.at(0)?.groupCurrency ?? selectedTransactionItems.at(0)?.currency;
127127
const numberOfExpense = shouldUseClientTotal
@@ -136,7 +136,7 @@ function SearchPage({route}: SearchPageProps) {
136136
const total = shouldUseClientTotal ? selectedTransactionItems.reduce((acc, transaction) => acc - (transaction.groupAmount ?? -Math.abs(transaction.amount)), 0) : metadata?.total;
137137

138138
return {count: numberOfExpense, total, currency};
139-
}, [areAllMatchingItemsSelected, metadata?.count, metadata?.currency, metadata?.total, selectedTransactions, selectedTransactionsKeys, shouldAllowFooterTotals]);
139+
}, [metadata?.count, metadata?.currency, metadata?.total, selectedTransactions, selectedTransactionsKeys, shouldAllowFooterTotals]);
140140

141141
const onSortPressedCallback = useCallback(() => {
142142
setIsSorting(true);

0 commit comments

Comments
 (0)