Skip to content

Commit f79eb38

Browse files
committed
codemod -> delete the optimized prop of the Datagrid component
1 parent 0b7d2c5 commit f79eb38

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/ra-core/codemods/replace-Datagrid-DataTable.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,15 @@ const replaceDatagrid = (root, j) => {
8080

8181
// Replace Datagrid with DataTable
8282
datagridComponents.replaceWith(({ node }) => {
83+
// remove the `optimized` attribute if it exists
84+
const attributes = node.openingElement.attributes.filter(
85+
attr =>
86+
!(j.JSXAttribute.check(attr) && attr.name.name === 'optimized')
87+
);
88+
8389
const openingElement = j.jsxOpeningElement(
8490
j.jsxIdentifier('DataTable'),
85-
node.openingElement.attributes,
91+
attributes,
8692
node.openingElement.selfClosing
8793
);
8894
const closingElement = j.jsxClosingElement(

0 commit comments

Comments
 (0)