mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat: reset accounts table query once the page unmount.
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user