Skip to content

Commit e4695e9

Browse files
committed
Match Xxx.Xxx instead of starting with DataTable.
1 parent 85ed6e9 commit e4695e9

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

packages/ra-ui-materialui/src/detail/ShowGuesser.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,13 @@ const ShowViewGuesser = (
7070
)
7171
)
7272
)
73+
.filter(component => !component.match(/[A-Za-z]+\.[A-Za-z]+/i))
7374
.sort();
7475

75-
const importsToLog = components.includes('DataTable')
76-
? components.filter(
77-
component => !component.startsWith('DataTable.')
78-
)
79-
: components;
80-
8176
console.log(
8277
`Guessed Show:
8378
84-
import { ${importsToLog.join(', ')} } from 'react-admin';
79+
import { ${components.join(', ')} } from 'react-admin';
8580
8681
export const ${capitalize(singularize(resource))}Show = () => (
8782
<Show>

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,14 @@ const ListViewGuesser = (
129129
)
130130
)
131131
)
132+
.filter(component => !component.match(/[A-Za-z]+\.[A-Za-z]+/i))
132133
.sort();
133134

134135
if (enableLog) {
135-
const importsToLog = components.includes('DataTable')
136-
? components.filter(
137-
component => !component.startsWith('DataTable.')
138-
)
139-
: components;
140-
141136
console.log(
142137
`Guessed List:
143138
144-
import { ${importsToLog.join(', ')} } from 'react-admin';
139+
import { ${components.join(', ')} } from 'react-admin';
145140
146141
export const ${capitalize(singularize(resource))}List = () => (
147142
<List>

0 commit comments

Comments
 (0)