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,
// #withAccountsActions
setAccountsTableState,
resetAccountsTableState,
}) {
// Resets the accounts table state once the page unmount.
useEffect(
() => () => {
setAccountsTableState({
filterRoles: [],
viewSlug: '',
pageIndex: 0,
});
resetAccountsTableState();
},
[setAccountsTableState],
[resetAccountsTableState],
);
return (

View File

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