diff --git a/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx b/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx index 5bd5d739d..e38729b2a 100644 --- a/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx +++ b/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx @@ -17,7 +17,7 @@ const SessionSearchQueryParamHandler = (props: Props) => { const applyFilterFromQuery = () => { const filter = getFiltersFromQuery(history.location.search, appliedFilter); - props.updateFilter(filter, true); + props.updateFilter(filter, true, false); }; const generateUrlQuery = () => { diff --git a/frontend/app/duck/search.js b/frontend/app/duck/search.js index 31f028bc3..1f68d1994 100644 --- a/frontend/app/duck/search.js +++ b/frontend/app/duck/search.js @@ -71,8 +71,11 @@ function reducer(state = initialState, action = {}) { case EDIT: return state.mergeIn(['instance'], action.instance).set('currentPage', 1); case APPLY: - - return action.fromUrl ? state.set('instance', Filter(action.filter)) : state.mergeIn(['instance'], action.filter).set('currentPage', 1); + state.mergeIn(['instance'], action.filter).set('currentPage', 1); + if (action.resetPage) { + state.set('currentPage', 1) + } + return state case success(FETCH): return state.set('instance', action.data); case success(FETCH_LIST): @@ -243,10 +246,11 @@ export const applyFilter = reduceThenFetchResource((filter, force = false) => ({ force, })); -export const updateFilter = (filter, force = false) => ({ +export const updateFilter = (filter, force = false, resetPage = true) => ({ type: APPLY, filter, force, + resetPage, }); export const updateCurrentPage = reduceThenFetchResource((page) => ({