Preact: Material UI Menu Component - Failed prop type: The following props are not supported: `ref`

Created on 30 Aug 2020  ยท  3Comments  ยท  Source: preactjs/preact

Reproduction

Material UI's Menu component throws error when using npm run dev, though error does not occur on a production build, deployed here.
sorry I tried to do a codesandbox but got a vnode error, not sure what that is.

Failed prop type: The following props are not supported: `ref`. Please remove them.

In fairness, it does not seem to break any functionality, so this is not a high priority issue at all.

Steps to reproduce

  1. clone my repo
  2. npm i; npm run dev
  3. look in console to witness error

Expected Behavior


no error

Actual Behavior

error

duplicate

Most helpful comment

gah, thanks for investigating! Sorted.

All 3 comments

Spent a while debugging this and these are the clues so far:

  • The error happens in one of the children of the MUI <Menu>-Component
  • It's a forwardRef which wraps a function, which renders a Portal

    • Just before checking prop-types we remove ref if _forwarded is present on the component constructor

    • Somehow this check is minified away. I can see it in the raw module inside node_modules but it is removed in the dev bundle :thinking:

Ah I got it! Turns out that this was a recent issue, which was fixed with #2685 . And here is the original issue #2682 .

Updating to the latest version of Preact (10.4.8) resolves this issue :tada:

gah, thanks for investigating! Sorted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajaraodv picture rajaraodv  ยท  3Comments

mizchi picture mizchi  ยท  3Comments

matthewmueller picture matthewmueller  ยท  3Comments

marcosguti picture marcosguti  ยท  3Comments

skaraman picture skaraman  ยท  3Comments