Skip to content

Commit e46d837

Browse files
committed
fix EditingCell liftcycle bug
1 parent 9428f2d commit e46d837

File tree

1 file changed

+7
-4
lines changed
  • packages/react-bootstrap-table2-editor/src

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { CLICK_TO_CELL_EDIT, DBCLICK_TO_CELL_EDIT } from './const';
77
export default (
88
Base,
99
{ _, remoteResolver }
10-
) =>
11-
class CellEditWrapper extends remoteResolver(Component) {
10+
) => {
11+
let EditingCell;
12+
return class CellEditWrapper extends remoteResolver(Component) {
1213
static propTypes = {
1314
options: PropTypes.shape({
1415
mode: PropTypes.oneOf([CLICK_TO_CELL_EDIT, DBCLICK_TO_CELL_EDIT]).isRequired,
@@ -24,6 +25,7 @@ export default (
2425

2526
constructor(props) {
2627
super(props);
28+
EditingCell = props.cellEdit.editingCellFactory(_);
2729
this.startEditing = this.startEditing.bind(this);
2830
this.escapeEditing = this.escapeEditing.bind(this);
2931
this.completeEditing = this.completeEditing.bind(this);
@@ -104,7 +106,7 @@ export default (
104106
const { isDataChanged, ...stateRest } = this.state;
105107
const {
106108
cellEdit: {
107-
options: { nonEditableRows, ...optionsRest },
109+
options: { nonEditableRows, errorMessage, ...optionsRest },
108110
editingCellFactory,
109111
...cellEditRest
110112
}
@@ -113,8 +115,8 @@ export default (
113115
...optionsRest,
114116
...cellEditRest,
115117
...stateRest,
118+
EditingCell,
116119
nonEditableRows: _.isDefined(nonEditableRows) ? nonEditableRows() : [],
117-
EditingCell: editingCellFactory(_),
118120
onStart: this.startEditing,
119121
onEscape: this.escapeEditing,
120122
onUpdate: this.handleCellUpdate
@@ -130,3 +132,4 @@ export default (
130132
);
131133
}
132134
};
135+
};

0 commit comments

Comments
 (0)