fix(ui): fix metadata in saved search
This commit is contained in:
parent
1035a1a219
commit
b9e2cafe4b
3 changed files with 8 additions and 5 deletions
|
|
@ -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 (
|
||||
<div className={cn("flex items-center", { [stl.disabled] : list.size === 0})}>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue