diff --git a/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.js b/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.js
index 585f3309541f07..cb69fb9c25fffe 100644
--- a/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.js
+++ b/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.js
@@ -340,6 +340,10 @@ export default function sxV6(file, api, options) {
}
if (data.node.argument.type === 'ConditionalExpression') {
const isSxSpread =
+ (data.node.argument.test.type === 'CallExpression' &&
+ data.node.argument.test.callee.type === 'MemberExpression' &&
+ data.node.argument.test.callee.object.name === 'Array' &&
+ data.node.argument.test.callee.property.name === 'isArray') ||
(data.node.argument.consequent.type === 'Identifier' &&
data.node.argument.consequent.name === 'sx') ||
(data.node.argument.alternate.type === 'Identifier' &&
diff --git a/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.test.js b/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.test.js
index 3dd70803719687..8ed3191f90b43e 100644
--- a/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.test.js
+++ b/packages/mui-codemod/src/v6.0.0/sx-prop/sx-v6.test.js
@@ -177,5 +177,29 @@ describe('@mui/codemod', () => {
expect(actual).to.equal(expected, 'The transformed version should be correct');
});
});
+
+ describe('inheritance sx-v6', () => {
+ it('should do nothing', () => {
+ const actual = transform(
+ { source: read('./test-cases/sx-inheritance.actual.js') },
+ { jscodeshift },
+ {},
+ );
+
+ const expected = read('./test-cases/sx-inheritance.expected.js');
+ expect(actual).to.equal(expected, 'The transformed version should be correct');
+ });
+
+ it('should be idempotent', () => {
+ const actual = transform(
+ { source: read('./test-cases/sx-inheritance.expected.js') },
+ { jscodeshift },
+ {},
+ );
+
+ const expected = read('./test-cases/sx-inheritance.expected.js');
+ expect(actual).to.equal(expected, 'The transformed version should be correct');
+ });
+ });
});
});
diff --git a/packages/mui-codemod/src/v6.0.0/sx-prop/test-cases/sx-inheritance.actual.js b/packages/mui-codemod/src/v6.0.0/sx-prop/test-cases/sx-inheritance.actual.js
new file mode 100644
index 00000000000000..bf1d69df2d1069
--- /dev/null
+++ b/packages/mui-codemod/src/v6.0.0/sx-prop/test-cases/sx-inheritance.actual.js
@@ -0,0 +1,18 @@
+;
+
+;
\ No newline at end of file
diff --git a/packages/mui-codemod/src/v6.0.0/sx-prop/test-cases/sx-inheritance.expected.js b/packages/mui-codemod/src/v6.0.0/sx-prop/test-cases/sx-inheritance.expected.js
new file mode 100644
index 00000000000000..bf1d69df2d1069
--- /dev/null
+++ b/packages/mui-codemod/src/v6.0.0/sx-prop/test-cases/sx-inheritance.expected.js
@@ -0,0 +1,18 @@
+;
+
+;
\ No newline at end of file