0

I am using the Autocomplete MUI component in a Preact app using Preact-cli. When I click into the textfield of the autocomplete component I get the following error.

Failed prop type: Cannot read properties of undefined (reading 'hasOwnProperty')
  in ForwardRef()
  in ForwardRef()
  in MuiPopperRoot
  in ForwardRef()
  in MuiAutocompletePopper
  in ForwardRef() (at /Users/name/code/parlibre/src/components/app.js:23)

I am using the following Autocomplete component for testing purposes.

<Autocomplete
   id="autocomplete"
   options={['1', '2', '3']}
   renderInput={(params) => <TextField {...params} label="autocomplete" />}
/>

This problem occurs when I build and serve using:

npm run build
npm run serve

but does not occur when I run it in a dev environment using: npm run dev

P.Bjur
  • 13
  • 4
  • I can't reproduce; I copy-pasted your example into a brand new `preact-cli` project and it worked without issue. What versions are you using? Did you clear the cache and remove the service worker? – rschristian Dec 15 '22 at 01:21
  • I ended up removing node modules and reinstalling which fixed the issue. Should have tried that before I guess. Thanks for the response. – P.Bjur Dec 24 '22 at 20:52

0 Answers0