mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
BIG-88: Reset table state once the table unmount.
This commit is contained in:
@@ -24,18 +24,14 @@ function CustomersList({
|
|||||||
customersTableStateChanged,
|
customersTableStateChanged,
|
||||||
|
|
||||||
// #withCustomersActions
|
// #withCustomersActions
|
||||||
setCustomersTableState,
|
resetCustomersTableState,
|
||||||
}) {
|
}) {
|
||||||
// Resets the accounts table state once the page unmount.
|
// Resets the accounts table state once the page unmount.
|
||||||
useEffect(
|
useEffect(
|
||||||
() => () => {
|
() => () => {
|
||||||
setCustomersTableState({
|
resetCustomersTableState();
|
||||||
filterRoles: [],
|
|
||||||
viewSlug: '',
|
|
||||||
pageIndex: 0,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
[setCustomersTableState],
|
[resetCustomersTableState],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
setCustomersTableState
|
setCustomersTableState,
|
||||||
|
resetCustomersTableState
|
||||||
} from 'store/customers/customers.actions';
|
} from 'store/customers/customers.actions';
|
||||||
|
|
||||||
export const mapDispatchToProps = (dispatch) => ({
|
export const mapDispatchToProps = (dispatch) => ({
|
||||||
setCustomersTableState: (state) => dispatch(setCustomersTableState(state)),
|
setCustomersTableState: (state) => dispatch(setCustomersTableState(state)),
|
||||||
|
resetCustomersTableState: () => dispatch(resetCustomersTableState()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps);
|
export default connect(null, mapDispatchToProps);
|
||||||
|
|||||||
@@ -24,18 +24,14 @@ function ExpensesList({
|
|||||||
expensesTableStateChanged,
|
expensesTableStateChanged,
|
||||||
|
|
||||||
// #withExpensesActions
|
// #withExpensesActions
|
||||||
setExpensesTableState,
|
resetExpensesTableState,
|
||||||
}) {
|
}) {
|
||||||
// Resets the accounts table state once the page unmount.
|
// Resets the accounts table state once the page unmount.
|
||||||
useEffect(
|
useEffect(
|
||||||
() => () => {
|
() => () => {
|
||||||
setExpensesTableState({
|
resetExpensesTableState();
|
||||||
filterRoles: [],
|
|
||||||
viewSlug: '',
|
|
||||||
pageIndex: 0,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
[setExpensesTableState],
|
[resetExpensesTableState],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { DashboardContentTable, DashboardPageContent } from 'components';
|
import { DashboardPageContent } from 'components';
|
||||||
|
|
||||||
import 'style/pages/Bills/List.scss';
|
import 'style/pages/Bills/List.scss';
|
||||||
|
|
||||||
@@ -24,18 +24,14 @@ function BillsList({
|
|||||||
billsTableStateChanged,
|
billsTableStateChanged,
|
||||||
|
|
||||||
// #withBillsActions
|
// #withBillsActions
|
||||||
setBillsTableState,
|
resetBillsTableState,
|
||||||
}) {
|
}) {
|
||||||
// Resets the accounts table state once the page unmount.
|
// Resets the accounts table state once the page unmount.
|
||||||
useEffect(
|
useEffect(
|
||||||
() => () => {
|
() => () => {
|
||||||
setBillsTableState({
|
resetBillsTableState();
|
||||||
filterRoles: [],
|
|
||||||
viewSlug: '',
|
|
||||||
pageIndex: 0,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
[setBillsTableState],
|
[resetBillsTableState],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -24,18 +24,14 @@ function VendorsList({
|
|||||||
vendorsTableStateChanged,
|
vendorsTableStateChanged,
|
||||||
|
|
||||||
// #withVendorsActions
|
// #withVendorsActions
|
||||||
setVendorsTableState,
|
resetVendorsTableState,
|
||||||
}) {
|
}) {
|
||||||
// Resets the vendors table state once the page unmount.
|
// Resets the vendors table state once the page unmount.
|
||||||
useEffect(
|
useEffect(
|
||||||
() => () => {
|
() => () => {
|
||||||
setVendorsTableState({
|
resetVendorsTableState();
|
||||||
filterRoles: [],
|
|
||||||
viewSlug: '',
|
|
||||||
pageIndex: 0,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
[setVendorsTableState],
|
[resetVendorsTableState],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { setVendorsTableState } from 'store/vendors/vendors.actions';
|
import {
|
||||||
|
setVendorsTableState,
|
||||||
|
resetVendorsTableState,
|
||||||
|
} from 'store/vendors/vendors.actions';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setVendorsTableState: (queries) => dispatch(setVendorsTableState(queries)),
|
setVendorsTableState: (queries) => dispatch(setVendorsTableState(queries)),
|
||||||
|
resetVendorsTableState: () => dispatch(resetVendorsTableState()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps);
|
export default connect(null, mapDispatchToProps);
|
||||||
|
|||||||
@@ -10,3 +10,8 @@ export const setCustomersTableState = (queries) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const resetCustomersTableState = () => {
|
||||||
|
return {
|
||||||
|
type: t.CUSTOMERS_TABLE_STATE_RESET,
|
||||||
|
};
|
||||||
|
}
|
||||||
6
client/src/store/vendors/vendors.actions.js
vendored
6
client/src/store/vendors/vendors.actions.js
vendored
@@ -5,4 +5,10 @@ export const setVendorsTableState = (queries) => {
|
|||||||
type: t.VENDORS_TABLE_STATE_SET,
|
type: t.VENDORS_TABLE_STATE_SET,
|
||||||
payload: { queries },
|
payload: { queries },
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const resetVendorsTableState = () => {
|
||||||
|
return {
|
||||||
|
type: t.VENDORS_TABLE_STATE_RESET,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
1
client/src/store/vendors/vendors.types.js
vendored
1
client/src/store/vendors/vendors.types.js
vendored
@@ -1,4 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
VENDORS_TABLE_STATE_SET: 'VENDORS/TABLE_STATE_SET',
|
VENDORS_TABLE_STATE_SET: 'VENDORS/TABLE_STATE_SET',
|
||||||
|
VENDORS_TABLE_STATE_RESET: 'VENDORS/TABLE_STATE_RESET',
|
||||||
VENDORS_SELECTED_ROWS_SET: 'VENDORS/SELECTED_ROWS_SET',
|
VENDORS_SELECTED_ROWS_SET: 'VENDORS/SELECTED_ROWS_SET',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user