diff --git a/client/src/containers/Customers/CustomersLanding/CustomersList.js b/client/src/containers/Customers/CustomersLanding/CustomersList.js index 118ebbe46..9bef377ba 100644 --- a/client/src/containers/Customers/CustomersLanding/CustomersList.js +++ b/client/src/containers/Customers/CustomersLanding/CustomersList.js @@ -24,18 +24,14 @@ function CustomersList({ customersTableStateChanged, // #withCustomersActions - setCustomersTableState, + resetCustomersTableState, }) { // Resets the accounts table state once the page unmount. useEffect( () => () => { - setCustomersTableState({ - filterRoles: [], - viewSlug: '', - pageIndex: 0, - }); + resetCustomersTableState(); }, - [setCustomersTableState], + [resetCustomersTableState], ); return ( diff --git a/client/src/containers/Customers/CustomersLanding/withCustomersActions.js b/client/src/containers/Customers/CustomersLanding/withCustomersActions.js index 8736d34dc..8a3e71b0a 100644 --- a/client/src/containers/Customers/CustomersLanding/withCustomersActions.js +++ b/client/src/containers/Customers/CustomersLanding/withCustomersActions.js @@ -1,10 +1,12 @@ import { connect } from 'react-redux'; import { - setCustomersTableState + setCustomersTableState, + resetCustomersTableState } from 'store/customers/customers.actions'; export const mapDispatchToProps = (dispatch) => ({ setCustomersTableState: (state) => dispatch(setCustomersTableState(state)), + resetCustomersTableState: () => dispatch(resetCustomersTableState()), }); export default connect(null, mapDispatchToProps); diff --git a/client/src/containers/Expenses/ExpensesLanding/ExpensesList.js b/client/src/containers/Expenses/ExpensesLanding/ExpensesList.js index 5bbbc1948..188057ea9 100644 --- a/client/src/containers/Expenses/ExpensesLanding/ExpensesList.js +++ b/client/src/containers/Expenses/ExpensesLanding/ExpensesList.js @@ -24,18 +24,14 @@ function ExpensesList({ expensesTableStateChanged, // #withExpensesActions - setExpensesTableState, + resetExpensesTableState, }) { // Resets the accounts table state once the page unmount. useEffect( () => () => { - setExpensesTableState({ - filterRoles: [], - viewSlug: '', - pageIndex: 0, - }); + resetExpensesTableState(); }, - [setExpensesTableState], + [resetExpensesTableState], ); return ( diff --git a/client/src/containers/Purchases/Bills/BillsLanding/BillsList.js b/client/src/containers/Purchases/Bills/BillsLanding/BillsList.js index 90d0e4964..d32a214f3 100644 --- a/client/src/containers/Purchases/Bills/BillsLanding/BillsList.js +++ b/client/src/containers/Purchases/Bills/BillsLanding/BillsList.js @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { DashboardContentTable, DashboardPageContent } from 'components'; +import { DashboardPageContent } from 'components'; import 'style/pages/Bills/List.scss'; @@ -24,18 +24,14 @@ function BillsList({ billsTableStateChanged, // #withBillsActions - setBillsTableState, + resetBillsTableState, }) { // Resets the accounts table state once the page unmount. useEffect( () => () => { - setBillsTableState({ - filterRoles: [], - viewSlug: '', - pageIndex: 0, - }); + resetBillsTableState(); }, - [setBillsTableState], + [resetBillsTableState], ); return ( diff --git a/client/src/containers/Vendors/VendorsLanding/VendorsList.js b/client/src/containers/Vendors/VendorsLanding/VendorsList.js index 4799ffc6e..c7566249a 100644 --- a/client/src/containers/Vendors/VendorsLanding/VendorsList.js +++ b/client/src/containers/Vendors/VendorsLanding/VendorsList.js @@ -24,18 +24,14 @@ function VendorsList({ vendorsTableStateChanged, // #withVendorsActions - setVendorsTableState, + resetVendorsTableState, }) { // Resets the vendors table state once the page unmount. useEffect( () => () => { - setVendorsTableState({ - filterRoles: [], - viewSlug: '', - pageIndex: 0, - }); + resetVendorsTableState(); }, - [setVendorsTableState], + [resetVendorsTableState], ); return ( diff --git a/client/src/containers/Vendors/VendorsLanding/withVendorsActions.js b/client/src/containers/Vendors/VendorsLanding/withVendorsActions.js index ecc17d9bf..f5b750592 100644 --- a/client/src/containers/Vendors/VendorsLanding/withVendorsActions.js +++ b/client/src/containers/Vendors/VendorsLanding/withVendorsActions.js @@ -1,8 +1,12 @@ import { connect } from 'react-redux'; -import { setVendorsTableState } from 'store/vendors/vendors.actions'; +import { + setVendorsTableState, + resetVendorsTableState, +} from 'store/vendors/vendors.actions'; const mapDispatchToProps = (dispatch) => ({ setVendorsTableState: (queries) => dispatch(setVendorsTableState(queries)), + resetVendorsTableState: () => dispatch(resetVendorsTableState()), }); export default connect(null, mapDispatchToProps); diff --git a/client/src/store/customers/customers.actions.js b/client/src/store/customers/customers.actions.js index 395288e73..e8eb8d8d3 100644 --- a/client/src/store/customers/customers.actions.js +++ b/client/src/store/customers/customers.actions.js @@ -10,3 +10,8 @@ export const setCustomersTableState = (queries) => { }; }; +export const resetCustomersTableState = () => { + return { + type: t.CUSTOMERS_TABLE_STATE_RESET, + }; +} \ No newline at end of file diff --git a/client/src/store/vendors/vendors.actions.js b/client/src/store/vendors/vendors.actions.js index 6147e2df8..a91167019 100644 --- a/client/src/store/vendors/vendors.actions.js +++ b/client/src/store/vendors/vendors.actions.js @@ -5,4 +5,10 @@ export const setVendorsTableState = (queries) => { type: t.VENDORS_TABLE_STATE_SET, payload: { queries }, }; +} + +export const resetVendorsTableState = () => { + return { + type: t.VENDORS_TABLE_STATE_RESET, + } } \ No newline at end of file diff --git a/client/src/store/vendors/vendors.types.js b/client/src/store/vendors/vendors.types.js index 715b29476..a4ad4e39a 100644 --- a/client/src/store/vendors/vendors.types.js +++ b/client/src/store/vendors/vendors.types.js @@ -1,4 +1,5 @@ export default { VENDORS_TABLE_STATE_SET: 'VENDORS/TABLE_STATE_SET', + VENDORS_TABLE_STATE_RESET: 'VENDORS/TABLE_STATE_RESET', VENDORS_SELECTED_ROWS_SET: 'VENDORS/SELECTED_ROWS_SET', };