Skip to content

Commit 6479209

Browse files
committed
Do not import DataTable.Col or DataTable.NumberCol
1 parent 51dc3cf commit 6479209

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/ra-ui-materialui/src/list/ListGuesser.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('<ListGuesser />', () => {
1010
await screen.findAllByText('top seller', undefined, { timeout: 2000 });
1111
expect(logSpy).toHaveBeenCalledWith(`Guessed List:
1212
13-
import { DataTable, DataTable.Col, DataTable.NumberCol, DateField, EmailField, List, ReferenceArrayField, ReferenceField } from 'react-admin';
13+
import { DataTable, DateField, EmailField, List, ReferenceArrayField, ReferenceField } from 'react-admin';
1414
1515
export const ProductList = () => (
1616
<List>
@@ -39,7 +39,7 @@ export const ProductList = () => (
3939
await screen.findByText('Jeans');
4040
expect(logSpy).toHaveBeenCalledWith(`Guessed List:
4141
42-
import { ArrayField, BooleanField, ChipField, DataTable, DataTable.Col, List, SingleFieldList } from 'react-admin';
42+
import { ArrayField, BooleanField, ChipField, DataTable, List, SingleFieldList } from 'react-admin';
4343
4444
export const CategoryList = () => (
4545
<List>
@@ -65,7 +65,7 @@ export const CategoryList = () => (
6565
await screen.findByText('top seller');
6666
expect(logSpy).toHaveBeenCalledWith(`Guessed List:
6767
68-
import { DataTable, DataTable.Col, List, UrlField } from 'react-admin';
68+
import { DataTable, List, UrlField } from 'react-admin';
6969
7070
export const TagList = () => (
7171
<List>

packages/ra-ui-materialui/src/list/ListGuesser.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,15 @@ const ListViewGuesser = (
132132
.sort();
133133

134134
if (enableLog) {
135+
const importsToLog = components.includes('DataTable')
136+
? components.filter(
137+
component => !component.startsWith('DataTable.')
138+
)
139+
: components;
135140
console.log(
136141
`Guessed List:
137142
138-
import { ${components.join(', ')} } from 'react-admin';
143+
import { ${importsToLog.join(', ')} } from 'react-admin';
139144
140145
export const ${capitalize(singularize(resource))}List = () => (
141146
<List>

0 commit comments

Comments
 (0)