feat: reset accounts table query once the page unmount.

This commit is contained in:
a.bouhuolia
2021-09-20 11:40:21 +02:00
parent 1390a6e2d5
commit f9c7db6bcf
2 changed files with 8 additions and 8 deletions

View File

@@ -25,18 +25,14 @@ function AccountsChart({
accountsTableStateChanged, accountsTableStateChanged,
// #withAccountsActions // #withAccountsActions
setAccountsTableState, resetAccountsTableState,
}) { }) {
// Resets the accounts table state once the page unmount. // Resets the accounts table state once the page unmount.
useEffect( useEffect(
() => () => { () => () => {
setAccountsTableState({ resetAccountsTableState();
filterRoles: [],
viewSlug: '',
pageIndex: 0,
});
}, },
[setAccountsTableState], [resetAccountsTableState],
); );
return ( return (

View File

@@ -1,8 +1,12 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { setAccountsTableState } from 'store/accounts/accounts.actions'; import {
setAccountsTableState,
resetAccountsTableState,
} from 'store/accounts/accounts.actions';
const mapActionsToProps = (dispatch) => ({ const mapActionsToProps = (dispatch) => ({
setAccountsTableState: (queries) => dispatch(setAccountsTableState(queries)), setAccountsTableState: (queries) => dispatch(setAccountsTableState(queries)),
resetAccountsTableState: () => dispatch(resetAccountsTableState()),
}); });
export default connect(null, mapActionsToProps); export default connect(null, mapActionsToProps);