Skip to content

Commit

Permalink
Merge pull request Expensify#48382 from Krishna2323/krishna2323/issue…
Browse files Browse the repository at this point in the history
…/47446

fix: Search - Inconsistency in selection mode behavior after holding and unholding expense.
  • Loading branch information
rlinoz authored Sep 9, 2024
2 parents 2ba5fd7 + 413bc42 commit 7ddbd56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
12 changes: 1 addition & 11 deletions src/components/Search/SearchPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import useNetwork from '@hooks/useNetwork';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode';
import * as SearchActions from '@libs/actions/Search';
import Navigation from '@libs/Navigation/Navigation';
import * as SearchUtils from '@libs/SearchUtils';
Expand Down Expand Up @@ -126,7 +125,7 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
const {isOffline} = useNetwork();
const {activeWorkspaceID} = useActiveWorkspace();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {selectedTransactions, clearSelectedTransactions} = useSearchContext();
const {selectedTransactions} = useSearchContext();
const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE);

const selectedTransactionsKeys = Object.keys(selectedTransactions ?? {});
Expand Down Expand Up @@ -196,9 +195,6 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
return;
}

if (selectionMode?.isEnabled) {
turnOffMobileSelectionMode();
}
Navigation.navigate(ROUTES.TRANSACTION_HOLD_REASON_RHP);
},
});
Expand All @@ -218,10 +214,6 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
return;
}

clearSelectedTransactions();
if (selectionMode?.isEnabled) {
turnOffMobileSelectionMode();
}
SearchActions.unholdMoneyRequestOnSearch(hash, selectedTransactionsKeys);
},
});
Expand Down Expand Up @@ -272,7 +264,6 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
selectedTransactions,
translate,
onSelectDeleteOption,
clearSelectedTransactions,
hash,
theme.icon,
styles.colorMuted,
Expand All @@ -283,7 +274,6 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
activeWorkspaceID,
selectedReports,
styles.textWrap,
selectionMode?.isEnabled,
]);

if (shouldUseNarrowLayout) {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Search/SearchHoldReasonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ type SearchHoldReasonPageProps = {
function SearchHoldReasonPage({route}: SearchHoldReasonPageProps) {
const {translate} = useLocalize();

const {currentSearchHash, selectedTransactions, clearSelectedTransactions} = useSearchContext();
const {currentSearchHash, selectedTransactions} = useSearchContext();
const {backTo = ''} = route.params ?? {};

const selectedTransactionIDs = Object.keys(selectedTransactions);
const onSubmit = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.MONEY_REQUEST_HOLD_FORM>) => {
SearchActions.holdMoneyRequestOnSearch(currentSearchHash, selectedTransactionIDs, values.comment);
clearSelectedTransactions();
Navigation.goBack();
};

Expand Down

0 comments on commit 7ddbd56

Please sign in to comment.