question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[10.0.0-rc.0] Issue with forwardRef in material ui SwipeableDrawer

See original GitHub issue

When creating a very basic app with just a render fn of:

                <SwipeableDrawer open={show_sidebar} onOpen={() => this.setState({ show_sidebar: true })} onClose={() => this.setState({ show_sidebar: false })}>
                    <Sidebar />
                </SwipeableDrawer>

based on latest material-ui I get the following issues with preact. If I switch to react it works fine with no errors

debug.module.js:2 Failed ForwardRef(Modal) type: Invalid ForwardRef(Modal) `children` supplied to `<ForwardRef(Modal) BackdropProps="[object Object]" BackdropComponent="function WithStyles(ForwardRef(Backdrop))() {}" className="MuiDrawer-root MuiDrawer-modal" open="true" onClose="function onClose() {}" ref="undefined" class="MuiDrawer-root MuiDrawer-modal" />`. Expected an element that can hold a ref. Did you accidentally use a plain function component for an element instead? For more information see https://material-ui.com/r/caveat-with-refs-guide
(anonymous) @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.__b @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.__b @ debug.module.js:2
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
T @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
A @ preact.module.js:13
setup_react @ main.js:63
(anonymous) @ main.js:83
main_setup @ main.js:81
(anonymous) @ main.js:93
./src/main.js @ main.js:8654
__webpack_require__ @ main.js:20
(anonymous) @ client:2
0 @ main.js:9223
__webpack_require__ @ main.js:20
(anonymous) @ main.js:84
(anonymous) @ main.js:87
Show 3 more frames
debug.module.js:2 Failed ForwardRef(Portal) type: The following props are not supported: `ref`. Please remove them.
(anonymous) @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.__b @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.__b @ debug.module.js:2
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
T @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
A @ preact.module.js:13
setup_react @ main.js:63
(anonymous) @ main.js:83
main_setup @ main.js:81
(anonymous) @ main.js:93
./src/main.js @ main.js:8654
__webpack_require__ @ main.js:20
(anonymous) @ client:2
0 @ main.js:9223
__webpack_require__ @ main.js:20
(anonymous) @ main.js:84
(anonymous) @ main.js:87
Show 5 more frames
debug.module.js:2 Failed ForwardRef(Slide) type: Invalid ForwardRef(Slide) `children` supplied to `<ForwardRef(Slide) in="true" direction="right" timeout="[object Object]" appear="false" role="document" tabIndex="-1" onEnter="function chainedFunction() {}" onExited="function chainedFunction() {}" ref="function () {}" />`. Expected an element that can hold a ref. Did you accidentally use a plain function component for an element instead? For more information see https://material-ui.com/r/caveat-with-refs-guide
(anonymous) @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.__b @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.__b @ debug.module.js:2
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
T @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
A @ preact.module.js:13
A @ compat.module.js:49
z @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
p.forceUpdate @ preact.module.js:13
w @ preact.module.js:13
Promise.then (async)
m @ preact.module.js:13
p.setState @ preact.module.js:13
preact__WEBPACK_IMPORTED_MODULE_0__.a.setState @ debug.module.js:2
o.__c.o.o @ hooks.module.js:13
(anonymous) @ Portal.js:41
E @ hooks.module.js:13
w @ hooks.module.js:13
preact__WEBPACK_IMPORTED_MODULE_0__.j.diffed @ hooks.module.js:13
preact__WEBPACK_IMPORTED_MODULE_0__.j.diffed @ debug.module.js:2
preact__WEBPACK_IMPORTED_MODULE_0__.j.diffed @ debug.module.js:2
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
T @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
g @ preact.module.js:13
P @ preact.module.js:13
A @ preact.module.js:13
setup_react @ main.js:63
(anonymous) @ main.js:83
main_setup @ main.js:81
(anonymous) @ main.js:93
./src/main.js @ main.js:8654
__webpack_require__ @ main.js:20
(anonymous) @ client:2
0 @ main.js:9223
__webpack_require__ @ main.js:20
(anonymous) @ main.js:84
(anonymous) @ main.js:87
Show 33 more frames
debug.module.js:2 Uncaught (in promise) TypeError: Cannot read property 'forEach' of null
    at preact__WEBPACK_IMPORTED_MODULE_0__.j.diffed (debug.module.js:2)
    at preact__WEBPACK_IMPORTED_MODULE_0__.j.diffed (debug.module.js:2)
    at P (preact.module.js:13)
    at g (preact.module.js:13)
    at P (preact.module.js:13)
    at p.forceUpdate (preact.module.js:13)
    at w (preact.module.js:13)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
developitcommented, Aug 8, 2019
0reactions
adonigcommented, Jul 8, 2020

@marvinhagemeister I will try to make a minimal reproducible example repository before I make a new issue. It’s kind of a complicated setup with Gatsby, Preact and Material UI and I’m not 100% sure who’s to blame.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SwipeableDrawer API - Material UI - MUI
API reference docs for the React SwipeableDrawer component. Learn about the props, CSS, and other APIs of this exported module.
Read more >
material-ui/core/CHANGELOG.md - UNPKG
This release widens the peer dependency scope of React to accept ^17.0.0. 32, The change makes it easier for developers to upgrade React...
Read more >
forwarded ref of material-ui component is always null
I used the forwardRef function from the react libary but my ref ist always null . The parent component function ParentComponent() { const ......
Read more >
@material-ui/core | Yarn - Package Manager
Every component except Dialog , MenuList , Modal , Popover and Tabs forward their innerRef (#14536). This is implemented by using React.forwardRef ....
Read more >
front-end/node_modules/@material-ui/styles/CHANGELOG.md
[core] Add issue template for material design issues (#21120) @eps1lon ... [styles] Bump jss dependencies to 10.0.0-alpha.25 (#17520) @eps1lon ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found