diff --git a/components/table/__tests__/Table.filter.test.js b/components/table/__tests__/Table.filter.test.js
index 8a4990d9a5..ffff2c32ab 100644
--- a/components/table/__tests__/Table.filter.test.js
+++ b/components/table/__tests__/Table.filter.test.js
@@ -82,16 +82,23 @@ describe('Table.filter', () => {
});
it('renders empty menu correctly', () => {
- const wrapper = mount(createTable({
- columns: [
- {
- ...column,
- filters: [],
- },
- ],
- }));
+ jest.spyOn(console, 'error').mockImplementation(() => undefined);
+ const wrapper = mount(
+ createTable({
+ columns: [
+ {
+ ...column,
+ filters: [],
+ },
+ ],
+ }),
+ );
wrapper.find('span.ant-dropdown-trigger').simulate('click', nativeEvent);
expect(wrapper.find('Empty').length).toBe(1);
+ // eslint-disable-next-line no-console
+ expect(console.error).not.toHaveBeenCalled();
+ // eslint-disable-next-line no-console
+ console.error.mockRestore();
});
it('renders radio filter correctly', () => {
diff --git a/components/table/hooks/useFilter/FilterDropdown.tsx b/components/table/hooks/useFilter/FilterDropdown.tsx
index 19d1e895df..cdd1d5c3ca 100644
--- a/components/table/hooks/useFilter/FilterDropdown.tsx
+++ b/components/table/hooks/useFilter/FilterDropdown.tsx
@@ -34,17 +34,21 @@ function renderFilterItems({
locale: TableLocale;
}) {
if (filters.length === 0) {
+ // wrapped with <>> to avoid react warning
+ // https://github.com/ant-design/ant-design/issues/25979
return (
-
+ <>
+
+ >
);
}
return filters.map((filter, index) => {