You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Popper and attempting to pass a fake, Virtual Element object in by setting the coordinates for the Popper, I'll get a prop-types warning in the console:
You can see the same one in the codesandbox demo.
This error is very misleading, and if I do some investigative work inside the React prop-types validation routine, I can find that this error is actually the result of React's prop-types validator assuming what was passed in had a shape it was after, when in fact, it was an error object, or error stack passed in by Material-UI. Here's the actual error stack, by running some console.log statements inside factoryWithTypeCheckers.js while Jest runs:
Error: Invalid prop `anchorEl` supplied to `ForwardRef(PopperUnstyled)`. Expected an HTMLElement.
at HTMLElementType (/workspaces/inter-afw/node_modules/@mui/utils/HTMLElementType.js:21:12)
at validate (/workspaces/inter-afw/node_modules/prop-types/factoryWithTypeCheckers.js:389:29)
at checkType (/workspaces/inter-afw/node_modules/prop-types/factoryWithTypeCheckers.js:219:16)
at Object.validate (/workspaces/inter-afw/node_modules/@mui/utils/chainPropTypes.js:14:12)
at checkPropTypes (/workspaces/inter-afw/node_modules/react/cjs/react-jsx-runtime.development.js:601:44)
at validatePropTypes (/workspaces/inter-afw/node_modules/react/cjs/react-jsx-runtime.development.js:1078:7)
at jsxWithValidation (/workspaces/inter-afw/node_modules/react/cjs/react-jsx-runtime.development.js:1198:7)
at jsxWithValidationDynamic (/workspaces/inter-afw/node_modules/react/cjs/react-jsx-runtime.development.js:1215:12)
at Popper (/workspaces/inter-afw/node_modules/@mui/material/node/Popper/Popper.js:42:43)
at renderWithHooks (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:14985:18)
at updateForwardRef (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:17044:20)
at beginWork (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:19098:16)
at beginWork$1 (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:23940:14)
at performUnitOfWork (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:22779:12)
at workLoopSync (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:22707:5)
at renderRootSync (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:22670:7)
at performSyncWorkOnRoot (/workspaces/inter-afw/node_modules/react-dom/cjs/react-dom.development.js:22293:18)
Expected behavior 馃
The propType for anchorEl should be a valid object and not log a warning message.
Steps to reproduce 馃暪
Link to CodeSandbox (a very lightly modified fork of the demo):
JeremyGrieshop
changed the title
Popper propTypes validation for VirtualElement throws an error
Popper propTypes validation for Virtual Element object throws an error
Jan 4, 2022
Wow, that totally fixed it (upgrading to prop-types 5.8.1)! I even searched facebook/prop-types first, but I guess he submitted the bug report and the PR literally minutes after I opened this one here.
Duplicates
Latest version
Current behavior 馃槸
When using the Popper and attempting to pass a fake, Virtual Element object in by setting the coordinates for the Popper, I'll get a prop-types warning in the console:
You can see the same one in the codesandbox demo.
This error is very misleading, and if I do some investigative work inside the React prop-types validation routine, I can find that this error is actually the result of React's prop-types validator assuming what was passed in had a shape it was after, when in fact, it was an error object, or error stack passed in by Material-UI. Here's the actual error stack, by running some console.log statements inside factoryWithTypeCheckers.js while Jest runs:
Expected behavior 馃
The propType for anchorEl should be a valid object and not log a warning message.
Steps to reproduce 馃暪
Link to CodeSandbox (a very lightly modified fork of the demo):
https://codesandbox.io/s/virtualelementpopper-material-demo-forked-n2tuj?file=/demo.js
Context 馃敠
It's just a warning, but shows up all over the place for me when I run tests.
Your environment 馃寧
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: