From e049e1b148ef0aaadfb8dd648741bb22a5990fc1 Mon Sep 17 00:00:00 2001
From: dhaub-exelixis <114945413+dhaub-exelixis@users.noreply.github.com>
Date: Tue, 14 Nov 2023 04:57:16 -0700
Subject: [PATCH] [material-ui][FilledInput] Fix slot props deepmerge order
(#38922)
---
packages/mui-material/src/FilledInput/FilledInput.js | 2 +-
packages/mui-material/src/FilledInput/FilledInput.test.js | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/packages/mui-material/src/FilledInput/FilledInput.js b/packages/mui-material/src/FilledInput/FilledInput.js
index ab672ed77d02f8..8d2a6b1aa4588c 100644
--- a/packages/mui-material/src/FilledInput/FilledInput.js
+++ b/packages/mui-material/src/FilledInput/FilledInput.js
@@ -234,7 +234,7 @@ const FilledInput = React.forwardRef(function FilledInput(inProps, ref) {
const componentsProps =
slotProps ?? componentsPropsProp
- ? deepmerge(slotProps ?? componentsPropsProp, filledInputComponentsProps)
+ ? deepmerge(filledInputComponentsProps, slotProps ?? componentsPropsProp)
: filledInputComponentsProps;
const RootSlot = slots.root ?? components.Root ?? FilledInputRoot;
diff --git a/packages/mui-material/src/FilledInput/FilledInput.test.js b/packages/mui-material/src/FilledInput/FilledInput.test.js
index e7ce5fde0068d7..cb79f65cbb5af3 100644
--- a/packages/mui-material/src/FilledInput/FilledInput.test.js
+++ b/packages/mui-material/src/FilledInput/FilledInput.test.js
@@ -1,6 +1,7 @@
import * as React from 'react';
import { expect } from 'chai';
import { createRenderer, describeConformance } from '@mui-internal/test-utils';
+import { styled } from '@mui/material/styles';
import FilledInput, { filledInputClasses as classes } from '@mui/material/FilledInput';
import InputBase from '@mui/material/InputBase';
@@ -67,4 +68,10 @@ describe('', () => {
);
expect(document.querySelector('[data-test=test]')).toHaveComputedStyle({ marginTop: '10px' });
});
+
+ it('should not throw: "Maximum call stack size exceeded" if both slotProps and an adornment are passed', () => {
+ const Adornment = styled('div')({});
+ render(} slotProps={{}} />);
+ render(} slotProps={{}} />);
+ });
});