-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'components-spinner' of undefined on WordPress 5.7 #31056
Comments
It's weird that the error
is happening in Bit of a Hail Mary, but any chance this is related to CSS-in-JS/G2, @sarayourfriend? |
Hi @ockham! I've been helping out @rawrndres with this issue some, and here's a bit more details if it helps: With unminified (
in function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) { ---ERROR HERE---
registeredStyles.push(registered[className]);
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
|
Likewise, the
(You can tell because there's no So this appears to be just a regular bug with Gutenberg rather than a style system thing. I did a little more digging but I couldn't see anything that would cause this issue. I'll do some research on how Update: this was the closest thing I could find in the Emotion issues about this: emotion-js/emotion#1728 |
Are components from the components package generally considered to be usable in a block save function? I'm not sure those components are really intended for that use. A lot of them have associated styling and event handling that wouldn't work when rendered to a string. Spinner is an interesting one, because it's just a span with some styling, but it looks like the css-in-js styles being rendered to a string is where this error is happening. For other components in the package that use scss stylesheets, I don't think those styles will be loaded on the front-end of a site. |
I second what @talldan said. It's very tricky to use regular React components inside the I would personally recommend using HTML tags, class names, and styles, or everything you would use in PHP to generate the output. |
I'll close this, as it hasn't had an update in a while, and the situation is still the same. |
Description
Adding the Spinner component to a custom block results in a blank post editor page. The block was compiled using create-guten-block: https://github.com/ahmadawais/create-guten-block
Block works properly in WordPress 5.6
Step-by-step reproduction instructions
Expected behaviour
No blank screen and the custom block loading properly.
Actual behaviour
The block and post editor load when first adding the block but pon saving and visiting the page again the Blank screen and errors in the console appear.
Screenshots or screen recording (optional)
https://snipboard.io/5eVHR0.jpg
Code snippet (optional)
https://gist.github.com/rawrndres/c9ca2bb111d9bb0d606fb6db21755c1e
Compiled with https://github.com/ahmadawais/create-guten-block
npm install
npm run build
WordPress information
Device information
The text was updated successfully, but these errors were encountered: