Skip to content

Commit

Permalink
Merge pull request #2398 from fahad-aot/bugfix/fwf-4027-search-result…
Browse files Browse the repository at this point in the history
…-retains-issue

bugfix/fwf-4027:Fixed search result retains issue
  • Loading branch information
arun-s-aot authored Dec 5, 2024
2 parents 25c1604 + 79fa9b2 commit 436057a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions forms-flow-web/src/actions/actionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const ACTION_CONSTANTS = {
BPM_FORM_TYPE: "BPM_FORM_TYPE",
BPM_FORM_LOADING: "BPM_FORM_LOADING",
BPM_FORM_SORT:"BPM_FORM_SORT",
BPM_CLIENT_FORM_SEARCH:"BPM_CLIENT_FORM_SEARCH",
//CheckList Form
DESIGNER_DENIED_ACCESS: "DESIGNER_DENIED_ACCESS",
FORM_CHECK_LIST_UPDATE: "FORM_CHECK_LIST_UPDATE",
Expand Down
6 changes: 6 additions & 0 deletions forms-flow-web/src/actions/formActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,9 @@ export const setBpmFormSort = (data) => (dispatch) => {
});
};

export const setClientFormSearch = ( data ) => (dispatch) => {
dispatch({
type: ACTION_CONSTANTS.BPM_CLIENT_FORM_SEARCH,
payload: data,
});
};
10 changes: 5 additions & 5 deletions forms-flow-web/src/components/Form/SubmitList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DRAFT_ENABLED } from "../../constants/constants";
import "../Form/List.scss";
import {
setBPMFormListLoading,
setBpmFormSearch,
setClientFormSearch,
setBPMFormListPage,
} from "../../actions/formActions";
import { fetchBPMFormList } from "../../apiManager/services/bpmFormServices";
Expand All @@ -22,7 +22,7 @@ import PropTypes from "prop-types";

const SubmitList = React.memo((props) => {
const { t } = useTranslation();
const searchText = useSelector((state) => state.bpmForms.searchText);
const searchText = useSelector((state) => state.bpmForms.clientFormSearch);
const tenantId = useSelector((state) => state.tenants?.tenantId);
const [search, setSearch] = useState(searchText || "");
const userRoles = useSelector((state) => state.user.roles || []);
Expand All @@ -35,16 +35,16 @@ const SubmitList = React.memo((props) => {

useEffect(() => {
if (!search?.trim()) {
dispatch(setBpmFormSearch(""));
dispatch(setClientFormSearch(""));
}
}, [search]);
const handleSearch = () => {
dispatch(setBpmFormSearch(search));
dispatch(setClientFormSearch(search));
dispatch(setBPMFormListPage(1));
};
const handleClearSearch = () => {
setSearch("");
dispatch(setBpmFormSearch(""));
dispatch(setClientFormSearch(""));
};
const { getFormsInit } = props;

Expand Down
5 changes: 4 additions & 1 deletion forms-flow-web/src/modules/bpmFormReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const initialState = {
visibility: { sortOrder: "asc"},
status: { sortOrder: "asc" },
},
clientFormSearch:"",
};

const bpmForms = (state = initialState, action) => {
Expand All @@ -44,8 +45,10 @@ const bpmForms = (state = initialState, action) => {
return { ...state, bpmFormLoading: action.payload };
case ACTION_CONSTANTS.BPM_FORM_TYPE:
return { ...state, formType: action.payload };
case ACTION_CONSTANTS.BPM_FORM_SORT:
case ACTION_CONSTANTS.BPM_FORM_SORT:
return { ...state, sort: action.payload };
case ACTION_CONSTANTS.BPM_CLIENT_FORM_SEARCH:
return { ...state, clientFormSearch: action.payload };
default:
return state;
}
Expand Down

0 comments on commit 436057a

Please sign in to comment.