Skip to content

Commit 86f58e3

Browse files
committed
fix(web) disallow deselecting all degrees on impact analysis view
1 parent 4811de1 commit 86f58e3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

datahub-web-react/src/app/search/SimpleSearchFilters.tsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { FacetFilterInput, FacetMetadata } from '../../types.generated';
44
import { FilterScenarioType } from './filters/render/types';
55
import { useFilterRendererRegistry } from './filters/render/useFilterRenderer';
66
import { SimpleSearchFilter } from './SimpleSearchFilter';
7-
import { ENTITY_FILTER_NAME, ENTITY_INDEX_FILTER_NAME, LEGACY_ENTITY_FILTER_NAME } from './utils/constants';
7+
import {
8+
DEGREE_FILTER_NAME,
9+
ENTITY_FILTER_NAME,
10+
ENTITY_INDEX_FILTER_NAME,
11+
LEGACY_ENTITY_FILTER_NAME,
12+
} from './utils/constants';
813

914
const TOP_FILTERS = ['degree', ENTITY_FILTER_NAME, 'platform', 'tags', 'glossaryTerms', 'domains', 'owners'];
1015

@@ -43,6 +48,15 @@ export const SimpleSearchFilters = ({ facets, selectedFilters, onFilterSelect, l
4348
: filter,
4449
)
4550
.filter((filter) => filter.field !== field || !(filter.values?.length === 0));
51+
52+
// Do not let user unselect all degree filters
53+
if (field === DEGREE_FILTER_NAME && !selected) {
54+
const hasDegreeFilter = newFilters.find((filter) => filter.field === DEGREE_FILTER_NAME);
55+
if (!hasDegreeFilter) {
56+
return;
57+
}
58+
}
59+
4660
setCachedProps({ ...cachedProps, selectedFilters: newFilters });
4761
onFilterSelect(newFilters);
4862
};

0 commit comments

Comments
 (0)