Skip to content

Commit 21960d4

Browse files
authored
fix: Remove cell memo (#425)
* fix: Remove cell memo * test case patch
1 parent 507c044 commit 21960d4

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/Cell/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,4 @@ function Cell<RecordType extends DefaultRecordType>(
187187
const RefCell = React.forwardRef(Cell);
188188
RefCell.displayName = 'Cell';
189189

190-
const MemoCell = React.memo(RefCell);
191-
MemoCell.displayName = 'Cell';
192-
193-
export default MemoCell;
190+
export default RefCell;

tests/Table.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,4 +766,27 @@ describe('Table.Basic', () => {
766766
.props()['data-row-key'],
767767
).toEqual('light');
768768
});
769+
770+
it('render with state change', () => {
771+
class Test extends React.Component {
772+
state = {
773+
change: false,
774+
columns: [
775+
{
776+
render: () => String(this.state.change),
777+
},
778+
],
779+
};
780+
781+
render() {
782+
return <Table columns={this.state.columns} data={[{ key: 1 }]} />;
783+
}
784+
}
785+
786+
const wrapper = mount(<Test />);
787+
expect(wrapper.find('td').text()).toEqual('false');
788+
789+
wrapper.setState({ change: true });
790+
expect(wrapper.find('td').text()).toEqual('true');
791+
});
769792
});

0 commit comments

Comments
 (0)