8000 [data grid] disabled variants leads to runtime error · Issue #17812 · mui/mui-x · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[data grid] disabled variants leads to runtime error #17812

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

Open
SimonGolms opened this issue May 12, 2025 · 0 comments
Open

[data grid] disabled variants leads to runtime error #17812

SimonGolms opened this issue May 12, 2025 · 0 comments
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@SimonGolms
Copy link
SimonGolms commented May 12, 2025

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/ritphqqu?file=src%2Ftheme.ts,src%2Findex.tsx

  2. Comment in to have the variant body1 disabled as documented here: https://mui.com/material-ui/customization/typography/#adding-amp-disabling-variants

    export const theme = createTheme({
      typography: {
        // Comment in to see breaking DataGrid
    -    // body1: undefined,
    +   body1: undefined,
      },
    });

Current behavior

DataGrid crash with console error:

@mui_x-data-grid.js?v=33698ce7:47800 Uncaught TypeError: Cannot read properties of undefined (reading 'fontWeight')
    at formatFont (@mui_x-data-grid.js?v=33698ce7:47800:18)
    at transformTheme (@mui_x-data-grid.js?v=33698ce7:47734:102)
    at @mui_x-data-grid.js?v=33698ce7:47714:23
    at mountMemo (react-dom_client.js?v=47e3fc84:5050:25)
    at Object.useMemo (react-dom_client.js?v=47e3fc84:16511:20)
    at exports.useMemo (chunk-37AZBUIX.js?v=7d05f891:939:36)
    at Object.useMaterialCSSVariables [as useCSSVariables] (@mui_x-data-grid.js?v=33698ce7:47712:19)
    at GridCSSVariablesContext (@mui_x-data-grid.js?v=33698ce7:3393:36)
    at react-stack-bottom-frame (react-dom_client.js?v=47e3fc84:17422:20)
    at renderWithHooks (react-dom_client.js?v=47e3fc84:4204:24)

Expected behavior

DataGrid does not crash or at least does not depend on hardcoded typography variants

Context

We use a custom theme where all the 13 default variants are disabled.

Your environment

No response

Search keywords: DataGrid, formatFont, variants, body1, caption

Order ID: 107362

@SimonGolms SimonGolms added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 12, 2025
@github-actions github-actions bot added component: data grid This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ labels May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

1 participant
0