Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Search - Inconsistency in selection mode behavior after holding and unholding expense. #48382

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@ -125,7 +124,7 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
const {isOffline} = useNetwork();
const {activeWorkspaceID} = useActiveWorkspace();
const {isSmallScreenWidth} = useResponsiveLayout();
const {selectedTransactions, clearSelectedTransactions} = useSearchContext();
const {selectedTransactions} = useSearchContext();
const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE);

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

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

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

if (isSmallScreenWidth) {
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
Loading