Skip to content

Commit a9490ca

Browse files
authored
chore: opt for warn perf (#972)
* chore: opt for warn perf * test: fix typo
1 parent ae3bc5b commit a9490ca

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Table.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,10 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco
570570
if (typeof colWidth === 'number' && !Number.isNaN(colWidth)) {
571571
return colWidth;
572572
}
573-
if (props.columns.length > 0) {
573+
574+
if (process.env.NODE_ENV !== 'production') {
574575
warning(
575-
false,
576+
props.columns.length === 0,
576577
'When use `components.body` with render props. Each column should have a fixed `width` value.',
577578
);
578579
}

tests/Table.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ describe('Table.Basic', () => {
701701
});
702702
});
703703

704-
it('without warning - columns is emplty', () => {
704+
it('without warning - columns is empty', () => {
705705
resetWarned();
706706
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
707707
mount(

0 commit comments

Comments
 (0)