-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximum Call Stack Size Exceeded Error with slotProps in Storybook for TextField Component #45287
Comments
Hi @MihirKotecha, thanks for the report. Looks like the issue has nothing to do with Storybook. I suggest to update your code and avoid passing a new object to Let me know if this works in your case. If not, you'd need to provide a reproduction so we can take a look. |
https://stackblitz.com/edit/vitejs-vite-88t3tdp4?file=src%2Fstories%2FPasswordWithToggle.stories.tsx Hi @aarongarciah, thnx for the response. I tried using Please lmk if there is anything else needed from my side. Thnx again |
I think it's both a usage issue and SB issue 🤔 @MihirKotecha Here's what worked for me: https://codesandbox.io/p/sandbox/happy-swanson-6xnxp5?file=%2Fsrc%2FApp.js%3A46%2C1
In your real application, do you intend to have a If so, I would suggest making two separate components and use them in your application and SB separately. In the case of the SB my understanding is that it's mostly for toggling between simple props like |
https://mui.com/material-ui/react-text-field/#input-adornments I suppose it would be quite easy to encounter this issue if you tried to do a simple/"direct" conversion of this password field example to |
Steps to reproduce
Create a
InputField
component as shown below:Create a Storybook story for this component using slotProps for a password field with a toggle feature, similar to the code below:
Run Storybook and load the story (PasswordWithToggle) to trigger the error.
Observe the error: Upon loading the Storybook page for the PasswordWithToggle, you will see the error: Maximum call stack size exceeded.
Current behavior
When loading the Storybook page for the
PasswordWithToggle
story, the following error is triggered:This error occurs when trying to render the
InputField
component with theslotProps
for the password toggle functionality. The component does not render properly, and the page fails to load as expected.The issue seems related to the recursive nature of the component rendering process, as indicated by the "Maximum call stack size exceeded" error message. This prevents the component from being displayed correctly in Storybook.
I have tried adjusting the
slotProps
structure and ensuring proper usage of state in the story, but the error persists.Expected behavior
The
InputField
component with the password toggle functionality should render properly in Storybook without throwing any errors.endAdornment
should display a clickableIconButton
with either theVisibility
orVisibilityOff
icon, depending on whether the password is being shown or hidden.InputField
component correctly, with the password toggle functionality working as expected.Context
No response
Your environment
npx @mui/envinfo
Search keywords: TextField, React Storybook
The text was updated successfully, but these errors were encountered: