You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mark one of the default typography variants as undefined
use responsiveFontSizes on the theme
Current behavior
When using the responsiveFontSizes on a theme where a default typography variant is disabled, the function crashs
Expected behavior
responsiveFontSizes should just ignore disabled variants and not crash
Context
I created a custom theme, with custom typography variants and disabled the default ones by marking them as undefined in the createTheme. and used the responsiveFontSizes to make the new variants as responsive, and it crashed
This is to be expected since we spread those variant definitions in a lot of places and there are no undefined checks. You could instead try to make them as empty object ({}) instead of undefined and see if that works.
But this way I cant have the type as undefined in Typescript, right? and so this variants will still show up in the typography as valid options, right?
Steps to reproduce
Link to live example:
https://stackblitz.com/edit/github-o8g8fe?file=src%2FApp.tsx
Steps:
Current behavior
When using the responsiveFontSizes on a theme where a default typography variant is disabled, the function crashs
Expected behavior
responsiveFontSizes should just ignore disabled variants and not crash
Context
I created a custom theme, with custom typography variants and disabled the default ones by marking them as undefined in the createTheme. and used the responsiveFontSizes to make the new variants as responsive, and it crashed
Your environment
npx @mui/envinfo
Search keywords: responsiveFontSizes, crash
The text was updated successfully, but these errors were encountered: