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
{{ message }}
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
When observer directly wraps a styled component from the very common library styled-components, the following error is thrown:
Uncaught TypeError: Cannot read property 'displayName' of undefined
at makeComponentReactive (mobx-react/index.module.js:857)
at target.render (mobx-react/index.module.js:1068)
at updateForwardRef (react-dom/cjs/react-dom.development.js:8254)
at beginWork (react-dom/cjs/react-dom.development.js:9002)
at performUnitOfWork (react-dom/cjs/react-dom.development.js:11814)
The above error occurred in the <ForwardRef> component
@dgcoffman / @pimterry could one of you submit a PR to this repo with a test case that fails, to make sure we are fixing the proper thing? If you need to add additional libraries as dev dependencies that is fine
When
observer
directly wraps a styled component from the very common librarystyled-components
, the following error is thrown:Here's my code https://codesandbox.io/s/k3np5pvmm3
package.json
Here's the Chrome debugger on the line that throws
Apparently
this
is undefined in the upstreammobx-react/src/observer.js
Line 356 in 2e2cf22
This only occurs with styled-components 4+ -- likely because they have switched to using React.forwardRef.
You will likely need some forwardRef check like
Relevant code from styled-components: https://github.com/styled-components/styled-components/blob/2975ff9f217c108737fa250bb3d8b38e017d9fa8/src/models/StyledComponent.js#L229
Any ideas?
Similar to #477
The text was updated successfully, but these errors were encountered: