tinacms: Cannot create styled-component for component: undefined
Description
By just following GitHub Backend tutorial, it produces this error:
Cannot create styled-component for component: undefined
Steps to reproduce
Here is the GitHub project. Its basically what you get when you follow “GitHub” backend tutorial.
These are important dependancies:
"next": "11.0.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"tinacms": "^0.42.1",
"react-tinacms-github": "^0.42.1",
"next-tinacms-github": "^0.42.1",
"sass": "^1.35.1",
"styled-components": "^5.3.0"
Environment
Tinacms Package Versions
├── UNMET PEER DEPENDENCY @tinacms/core@^0.29.0
├── UNMET PEER DEPENDENCY @tinacms/fields@^0.29.0
├── next-tinacms-github@0.42.1
├── react-tinacms-github@0.42.1
├── tinacms@0.42.1
Tools
| Tool | Version |
|---|---|
| browser | Safari |
| os | Mac |
| node | v14.15.1 |
| npm | 6.14.8 |
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 17 (8 by maintainers)
More, hopefully, good news 😃
I believe I’ve found the issue with the render method of the
AsyncButtonand I’ve merged the fix: https://github.com/tinacms/tina-graphql-gateway/pull/355The fix is up on the
betachannel fortina-graphql-gateway.Hopefully good news 😄
I’ve identified another dependency issue that appears to fix the
styled-componentproblem: https://github.com/tinacms/tinacms/pull/1875It has been released on the
nextchannel, so you can use:Crossing my fingers that this takes care of the problems listed here 👍 If it does, we’ll make the fix part of the next release.
I’ve also had the same issue when trying to upgrade to TinaCMS
v0.42.1. It’s also present when trying to upgrade to0.43.0-alpha.1(which is now the latest version)In my case it looks like the error is thrown by the
react-tinacms-inlinepackage, which is only needed in my project as it’s required by thereact-tinacms-editorpackage (not sure how that compares with the tutorials you others are following).I was able to temporarily workaround the issue but still upgrade to the latest version of
tinacmsby commenting out the following line in my code (which I previously passed as an option withinnew TinaCMS):There are a few ways to add plugins so something similar might appear in those other tutorials as
cms.plugins.add(MarkdownFieldPlugin)orusePlugins([MarkdownFieldPlugin]). TheHtmlFieldPluginalso seems to throw the same error.Obviously this is not a proper fix but might at least allow you to complete the tutorials, just with plain textarea fields rather than HTML/markdown content editors. Hope that helps someone, and that it’s possible to resolve the underlying issue soon.
PS: For what it’s worth, recreating the error is as simple as running
import "react-tinacms-inline";Just to report that original issue I submitted:
“Cannot create styled-component for component: undefined”
Is solved with the latest packages:
Thank you guys!
This is perfect, @coreyaus 👍
Turns out it was pretty simple to recreate, so I’ll start chasing this.
Hope to have an update (or at least an idea) sometime today.
I’m also seeing a potentially related error on my project, which uses Tina Cloud. When using the
createCloudClientmethod and completing the authentication process the user is initially redirected to an error page with the following message:When refreshing the page everything works as expected. That is, the error only appears when landing back on an admin page straight after the authentication process is complete. A full page reload will render everything as expected.
This may be unrelated but I’m including here in case it hints at a possible cause or potential fix to someone more familiar with the internals of the project (i.e. perhaps this relates to the render method of the
AsyncButtoncomponent?)I second this problem. Been trying to solve it for 2 whole evenings, naturally thinking the problem was me. Thank you for raising @mbrain-io