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