Skip to content

Commit 7402a5e

Browse files
committed
fix: update shouldDisplayGroupByFilter logic
1 parent 86df7a0 commit 7402a5e

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/hooks/useAdvancedSearchFilters.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type {SearchAdvancedFiltersForm} from '@src/types/form';
99
import type {Policy, PolicyCategories, PolicyTagLists} from '@src/types/onyx';
1010
import type {PolicyFeatureName} from '@src/types/onyx/Policy';
1111
import {getEmptyObject, isEmptyObject} from '@src/types/utils/EmptyObject';
12-
import useEnvironment from './useEnvironment';
1312
import useLocalize from './useLocalize';
1413
import useOnyx from './useOnyx';
1514
import useWorkspaceList from './useWorkspaceList';
@@ -154,9 +153,9 @@ function isFeatureEnabledInPolicies(policies: OnyxCollection<Policy>, featureNam
154153

155154
function useAdvancedSearchFilters() {
156155
const {localeCompare} = useLocalize();
157-
const {isDevelopment} = useEnvironment();
158156
const [searchAdvancedFilters = getEmptyObject<SearchAdvancedFiltersForm>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
159157
const policyID = searchAdvancedFilters.policyID;
158+
const groupBy = searchAdvancedFilters.groupBy;
160159
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
161160
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: false});
162161
const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList, true), [userCardList, workspaceCardFeeds]);
@@ -209,9 +208,7 @@ function useAdvancedSearchFilters() {
209208
const shouldDisplayCardFilter = shouldDisplayFilter(Object.keys(allCards).length, areCardsEnabled);
210209
const shouldDisplayTaxFilter = shouldDisplayFilter(Object.keys(taxRates).length, areTaxEnabled);
211210
const shouldDisplayWorkspaceFilter = workspaces.some((section) => section.data.length !== 0);
212-
213-
// s77rt remove DEV lock
214-
const shouldDisplayGroupByFilter = isDevelopment;
211+
const shouldDisplayGroupByFilter = groupBy === CONST.SEARCH.GROUP_BY.FROM || groupBy === CONST.SEARCH.GROUP_BY.CARD;
215212

216213
let currentType = searchAdvancedFilters?.type ?? CONST.SEARCH.DATA_TYPES.EXPENSE;
217214

0 commit comments

Comments
 (0)