Skip to content

Commit 4d04b75

Browse files
authored
fix wrong HOC for SortWrapper (#148)
1 parent 00f1105 commit 4d04b75

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/react-bootstrap-table2/src/sort/wrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { Component } from 'react';
55
import PropTypes from 'prop-types';
66

7-
import { paginationElement } from '../table-factory';
7+
import { sortableElement } from '../table-factory';
88

99
class SortWrapper extends Component {
1010
constructor(props) {
@@ -34,7 +34,7 @@ class SortWrapper extends Component {
3434
}
3535

3636
render() {
37-
return paginationElement({
37+
return sortableElement({
3838
...this.props,
3939
ref: node => this.table = node,
4040
onSort: this.handleSort,

packages/react-bootstrap-table2/src/table-factory.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ export const pureTable = props =>
2020
React.createElement(BootstrapTable, { ...props });
2121

2222
export const wrapWithPagination = (props) => {
23-
const { wrapper } = props.pagination;
24-
const PaginationBase = wrapper(pureTable);
25-
return React.createElement(PaginationBase, { ...props });
23+
if (props.pagination) {
24+
const { wrapper } = props.pagination;
25+
const PaginationBase = wrapper(pureTable);
26+
return React.createElement(PaginationBase, { ...props });
27+
}
28+
return pureTable(props);
2629
};
27-
export const paginationElement = props => pureTable(props);
2830

2931
export const sortableElement = props => wrapWithPagination(props);
3032

0 commit comments

Comments
 (0)