From 34c07b722ebf9731e8567fe627d9cf64bb7c1a2e Mon Sep 17 00:00:00 2001 From: Nikola Stojanovic <68916411+dzonidoo@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:59:15 +0100 Subject: [PATCH] Selection of Planning filter is lost on scrolling down and up - update (#1902) --- client/api/ui/list.ts | 3 ++- client/components/Main/FiltersBox.tsx | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/api/ui/list.ts b/client/api/ui/list.ts index 9a7d2b48d..fce2f1593 100644 --- a/client/api/ui/list.ts +++ b/client/api/ui/list.ts @@ -102,8 +102,9 @@ function changeFilterId(id: ISearchFilter['_id'], params: ICombinedEventOrPlanni type: EVENTS_PLANNING.ACTIONS.SELECT_EVENTS_PLANNING_FILTER, payload: id, }); - urlParams.setString('eventsPlanningFilter', id); } + urlParams.setString('eventsPlanningFilter', id); + return reloadList(params); } diff --git a/client/components/Main/FiltersBox.tsx b/client/components/Main/FiltersBox.tsx index 98eeadaea..a21719f51 100644 --- a/client/components/Main/FiltersBox.tsx +++ b/client/components/Main/FiltersBox.tsx @@ -7,20 +7,29 @@ import {StretchBar} from '../UI/SubNav'; import {PLANNING_VIEW} from '../../interfaces'; import {activeFilter as getCurrentView} from '../../selectors/main'; -import {planningApi} from '../../superdeskApi'; +import {planningApi, superdeskApi} from '../../superdeskApi'; import {PRIVILEGES} from '../../constants'; +import * as selectors from '../../selectors'; interface IProps { showFilters?: boolean; // defaults to true currentView: PLANNING_VIEW; privileges: {[key: string]: number}; + currentFilterId?: any; } const mapStateToProps = (state) => ({ currentView: getCurrentView(state), + currentFilterId: selectors.main.currentSearchFilterId(state), }); class FiltersBoxComponent extends React.PureComponent { + componentDidUpdate(): void { + const {urlParams} = superdeskApi.browser.location; + + urlParams.setString('eventsPlanningFilter', this.props.currentFilterId); + } + render() { const privileges = this.props.privileges; let filter_items = [];