Skip to content
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

TypeError: Cannot use 'in' operator to search for 'colorSchemes' in null #44510

Closed
Hammond2789 opened this issue Nov 22, 2024 · 3 comments
Closed
Labels
package: system Specific to @mui/system support: question Community support but can be turned into an improvement

Comments

@Hammond2789
Copy link

Hammond2789 commented Nov 22, 2024

Steps to reproduce

Steps:

import { createTheme, ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
const thisTheme = createTheme({});
...
render() {
    return (
      <div className="App" style={{ height: "100%" }}>
        <StyledEngineProvider injectFirst>
          <ThemeProvider
            theme={thisTheme}
          >
            <SnackbarProvider
              domRoot={document.getElementById("notification-container")}
              iconVariant={{
                info: <NotificationsActive style={{ marginRight: 8 }} />,
              }}
            >
...
            </SnackbarProvider>
          </ThemeProvider>
        </StyledEngineProvider>
      </div>
    );
  }

Current behavior

When I try to open my web application I get the following error from within ThemeProvider line 20.

TypeError: Cannot use 'in' operator to search for 'colorSchemes' in null

Expected behavior

Not to get that error.

Context

I am attempting to upgrade to material v6 from v5. I believe I have followed the instructions from the upgrade webpage.

I have checked the documentation for Themes and I do not see any changes from v5 (please tell me if I am wrong).

Your environment

npx @mui/envinfo

System:
OS: Windows 10 10.0.19045
Binaries:
Node: 20.16.0 - C:\Program Files\nodejs\node.EXE
npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
pnpm: Not Found
Browsers:
Chrome: 131.0.6778.86
Edge: Chromium (128.0.2739.67)
npmPackages:
@emotion/react: ^11.13.5 => 11.13.5
@emotion/styled: ^11.13.5 => 11.13.5
@mui/base: ^5.0.0-beta.62 => 5.0.0-beta.62
@mui/core-downloads-tracker: 6.1.8
@mui/icons-material: ^6.0.0 => 6.1.8
@mui/lab: ^6.0.0-beta.16 => 6.0.0-beta.16
@mui/material: ^6.0.0 => 6.1.8
@mui/private-theming: 6.1.8
@mui/styled-engine: 6.1.8
@mui/system: 6.1.8
@mui/types: 7.2.19
@mui/utils: 6.1.8
@mui/x-date-pickers: ^7.22.2 => 7.22.3
@mui/x-internals: 7.21.0
@mui/x-tree-view: ^7.22.1 => 7.22.1
@types/react: 18.3.12
react: ^18.2.0 => 18.3.1
react-dom: ^18.2.0 => 18.3.1

Search keywords: colorSchemes

@Hammond2789 Hammond2789 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 22, 2024
@oliviertassinari oliviertassinari added the package: system Specific to @mui/system label Nov 24, 2024
@siriwatknp
Copy link
Member

siriwatknp commented Nov 25, 2024

@Hammond2789 please provide a reproducible sandbox or a repo that I can take a look.

@siriwatknp siriwatknp added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 25, 2024
@Hammond2789
Copy link
Author

I fixed the problem. The problem came from the fact I had a second

    <StyledEngineProvider injectFirst>
      <ThemeProvider theme={{[THEME_ID]:thisTheme}}>

further down in the application, removing this stopped the error.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Nov 28, 2024
@siriwatknp siriwatknp added support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 29, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@Hammond2789 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: system Specific to @mui/system support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants