mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: Optimize connect component props with redux store.
This commit is contained in:
@@ -7,20 +7,22 @@ import {
|
||||
getCurrentPageResults
|
||||
} from 'store/selectors';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const viewPages = getViewPages(state.items.views, state.items.currentViewId);
|
||||
|
||||
return {
|
||||
itemsViews: getResourceViews(state, 'items'),
|
||||
itemsCurrentPage: getCurrentPageResults(
|
||||
state.items.items,
|
||||
viewPages,
|
||||
state.items.currentPage,
|
||||
),
|
||||
itemsBulkSelected: state.items.bulkActions,
|
||||
itemsTableLoading: state.items.loading,
|
||||
itemsTableQuery: state.items.tableQuery,
|
||||
export default (mapState) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
const viewPages = getViewPages(state.items.views, state.items.currentViewId);
|
||||
const mapped = {
|
||||
itemsViews: getResourceViews(state, 'items'),
|
||||
itemsCurrentPage: getCurrentPageResults(
|
||||
state.items.items,
|
||||
viewPages,
|
||||
state.items.currentPage,
|
||||
),
|
||||
itemsBulkSelected: state.items.bulkActions,
|
||||
itemsTableLoading: state.items.loading,
|
||||
itemsTableQuery: state.items.tableQuery,
|
||||
};
|
||||
return mapState ? mapState(mapped, state, props) : mapped;
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps);
|
||||
return connect(mapStateToProps);
|
||||
};
|
||||
Reference in New Issue
Block a user