diff --git a/src/PageSizeContainer.js b/src/PageSizeContainer.js index 0534686..6fcbda2 100644 --- a/src/PageSizeContainer.js +++ b/src/PageSizeContainer.js @@ -4,7 +4,8 @@ import makeSelectors from './selectors'; import { tablePageSizeChanged } from './actions'; import PageSize from './PageSize'; -const mapStateToProps = (state, { tableName }) => { +const mapStateToProps = (state, props) => { + const { tableName } = props; const selectors = makeSelectors(tableName); const isInitialized = selectors.getIsInitialized(state); @@ -14,7 +15,7 @@ const mapStateToProps = (state, { tableName }) => { }; } - const pageInfo = selectors.getPageInfo(state); + const pageInfo = selectors.getPageInfo(state, props); return { isInitialized, diff --git a/src/PaginationContainer.js b/src/PaginationContainer.js index 7a5a8ed..0f627a4 100644 --- a/src/PaginationContainer.js +++ b/src/PaginationContainer.js @@ -4,7 +4,8 @@ import makeSelectors from './selectors'; import { tablePageChanged } from './actions'; import Pagination from './Pagination'; -const mapStateToProps = (state, { tableName }) => { +const mapStateToProps = (state, props) => { + const { tableName } = props; const selectors = makeSelectors(tableName); const isInitialized = selectors.getIsInitialized(state); @@ -14,7 +15,7 @@ const mapStateToProps = (state, { tableName }) => { }; } - const pageInfo = selectors.getPageInfo(state); + const pageInfo = selectors.getPageInfo(state, props); return { isInitialized, diff --git a/src/selectors.js b/src/selectors.js index 5ba6ea5..06df984 100644 --- a/src/selectors.js +++ b/src/selectors.js @@ -96,7 +96,7 @@ export default (tableName) => { _.get(state.sematable[tableName], prop) : undefined; const tableOrComponentProp = (state, props, prop) => { - if (props[prop] !== undefined) { + if (props && props[prop] !== undefined) { return props[prop]; } @@ -112,7 +112,7 @@ export default (tableName) => { const getPage = (state) => tableProp(state, 'page'); const getPrimaryKey = (state) => tableProp(state, 'primaryKey'); const getPageSize = (state, props) => tableOrComponentProp(state, props, 'pageSize'); - const getPageSizes = (state, props) => tableProp(state, 'pageSizes'); + const getPageSizes = (state) => tableProp(state, 'pageSizes'); const getUserSelection = (state) => tableProp(state, 'userSelection'); const getSelectAll = (state) => tableProp(state, 'selectAll'); const getSortInfo = (state) => ({