diff --git a/frontend/app/components/shared/SavedSearch/SavedSearch.tsx b/frontend/app/components/shared/SavedSearch/SavedSearch.tsx
index f85a961f2..f5cdfb889 100644
--- a/frontend/app/components/shared/SavedSearch/SavedSearch.tsx
+++ b/frontend/app/components/shared/SavedSearch/SavedSearch.tsx
@@ -11,6 +11,7 @@ interface Props {
fetchListSavedSearch: () => void;
list: any;
savedSearch: any;
+ fetchedMeta: boolean
}
function SavedSearch(props: Props) {
const { list } = props;
@@ -18,10 +19,10 @@ function SavedSearch(props: Props) {
const { showModal } = useModal();
useEffect(() => {
- if (list.size === 0) {
+ if (list.size === 0 && props.fetchedMeta) {
props.fetchListSavedSearch()
}
- }, [])
+ }, [props.fetchedMeta])
return (
@@ -48,5 +49,6 @@ function SavedSearch(props: Props) {
export default connect((state: any) => ({
list: state.getIn([ 'search', 'list' ]),
- savedSearch: state.getIn([ 'search', 'savedSearch' ])
+ savedSearch: state.getIn([ 'search', 'savedSearch' ]),
+ fetchedMeta: state.getIn(['customFields', 'fetchedMetadata'])
}), { fetchListSavedSearch })(SavedSearch);
diff --git a/frontend/app/duck/customField.js b/frontend/app/duck/customField.js
index ac9f4d8b6..db99ee8cf 100644
--- a/frontend/app/duck/customField.js
+++ b/frontend/app/duck/customField.js
@@ -38,6 +38,7 @@ const FETCH_SOURCES_SUCCESS = success(FETCH_SOURCES);
const initialState = Map({
list: List(),
instance: CustomField(),
+ fetchedMetadata: false,
sources: List(),
optionsReady: false,
});
@@ -54,7 +55,7 @@ const reducer = (state = initialState, action = {}) => {
addElementToFlagConditionsMap(FilterCategory.METADATA, '_' + item.key)
addElementToConditionalFiltersMap(FilterCategory.METADATA, '_' + item.key)
});
- return state.set('list', List(action.data).map(CustomField))
+ return state.set('list', List(action.data).map(CustomField)).set('fetchedMetadata', true)
case FETCH_SOURCES_SUCCESS:
return state.set(
diff --git a/frontend/app/types/filter/newFilter.js b/frontend/app/types/filter/newFilter.js
index b5305b343..a583be88d 100644
--- a/frontend/app/types/filter/newFilter.js
+++ b/frontend/app/types/filter/newFilter.js
@@ -849,7 +849,7 @@ export default Record({
_filter = subFilterMap[type];
} else {
if (type === FilterKey.METADATA) {
- _filter = filtersMap[filter.source];
+ _filter = filtersMap[`_${filter.source}`];
} else {
if (filtersMap[filter.key]) {
_filter = filtersMap[filter.key]