Skip to content

Commit

Permalink
Fix props not passed to selectors in containers
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-hadzic committed Dec 18, 2018
1 parent e31abfb commit 61b830b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/PageSizeContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -14,7 +15,7 @@ const mapStateToProps = (state, { tableName }) => {
};
}

const pageInfo = selectors.getPageInfo(state);
const pageInfo = selectors.getPageInfo(state, props);

return {
isInitialized,
Expand Down
5 changes: 3 additions & 2 deletions src/PaginationContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -14,7 +15,7 @@ const mapStateToProps = (state, { tableName }) => {
};
}

const pageInfo = selectors.getPageInfo(state);
const pageInfo = selectors.getPageInfo(state, props);

return {
isInitialized,
Expand Down
4 changes: 2 additions & 2 deletions src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand All @@ -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) => ({
Expand Down

0 comments on commit 61b830b

Please sign in to comment.