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

Using ownerState is undefined in styleOverrides for Autocomplete on opening the options #43992

Closed
hon2a opened this issue Oct 4, 2024 · 4 comments · Fixed by #43994
Closed
Assignees
Labels
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module! regression A bug, but worse

Comments

@hon2a
Copy link

hon2a commented Oct 4, 2024

Steps to reproduce

Link to live example: CodeSandbox

Steps:

  1. Create a theme containing a style override for the Autocomplete component that makes use of ownerState (reads one of its properties).
  2. Render a simple Autocomplete with that theme.
  3. Click on the Autocomplete to open the list of options.

Current behavior

The application crashes with the following error:

Cannot read properties of undefined (reading '{PROPERTY_NAME}')

because the style override function is called without an ownerState (which should never happen).

Expected behavior

ownerState is always passed to the style override, the list of options opens without any issue.

Context

I'm trying to restyle the component to match the company design system.

Your environment

npx @mui/envinfo
 System:
    OS: macOS 14.6.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 21.04 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 17.7.1 - ~/.nvm/versions/node/v17.7.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v17.7.1/bin/yarn
    npm: 8.5.2 - ~/.nvm/versions/node/v17.7.1/bin/npm
    pnpm: 7.17.0 - ~/.nvm/versions/node/v17.7.1/bin/pnpm
  Managers:
    Homebrew: 4.2.5 - /usr/local/bin/brew
    pip3: 22.0.4 - /usr/local/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 15.0.0 - /usr/bin/gcc
    Git: 2.39.3 - /usr/bin/git
    Clang: 15.0.0 - /usr/bin/clang
    FFmpeg: 6.1.1 - /usr/local/bin/ffmpeg
    Curl: 8.7.1 - /usr/bin/curl
    OpenSSL: 3.2.0 - /usr/local/bin/openssl
  Servers:
    Apache: 2.4.59 - /usr/sbin/apachectl
  IDEs:
    Vim: 9.0 - /usr/bin/vim
    WebStorm: 2024.2.2
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 17.0.4.1 - /Users/jan.konopasek/.sdkman/candidates/java/current/bin/javac
    Perl: 5.34.1 - /usr/bin/perl
    Python3: 3.9.12 - /usr/local/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
  Databases:
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Chrome: 129.0.6668.89
    Safari: 17.6

Tested on Chrome.

Search keywords: Autocomplete ownerState styleOverrides

@hon2a hon2a added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 4, 2024
@noobDev31
Copy link

Yes happpening for me as well after V6 migration

@sai6855
Copy link
Contributor

sai6855 commented Oct 4, 2024

PR created: #43994

@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Oct 4, 2024
@sai6855
Copy link
Contributor

sai6855 commented Oct 4, 2024

A regression from #41875

@mnajdova mnajdova added bug 🐛 Something doesn't work regression A bug, but worse and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 5, 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

@hon2a 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
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module! regression A bug, but worse
Projects
None yet
6 participants