From a9490ca8040172d7c7003f176255c2f2668b9cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Fri, 17 Mar 2023 12:00:43 +0800 Subject: [PATCH] chore: opt for warn perf (#972) * chore: opt for warn perf * test: fix typo --- src/Table.tsx | 5 +++-- tests/Table.spec.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Table.tsx b/src/Table.tsx index 41d2cd877..2be5e02a3 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -570,9 +570,10 @@ function Table(tableProps: TableProps 0) { + + if (process.env.NODE_ENV !== 'production') { warning( - false, + props.columns.length === 0, 'When use `components.body` with render props. Each column should have a fixed `width` value.', ); } diff --git a/tests/Table.spec.js b/tests/Table.spec.js index 8e4fec37d..f7ec77a15 100644 --- a/tests/Table.spec.js +++ b/tests/Table.spec.js @@ -701,7 +701,7 @@ describe('Table.Basic', () => { }); }); - it('without warning - columns is emplty', () => { + it('without warning - columns is empty', () => { resetWarned(); const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); mount(