Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Styles variations don't work for blocks using `InnerBlocks` #9897
Describe the bug
The copied error is like below:
This issue raises something interesting:
It's impossible to "preview" a block (Use
One potential solution is to change how
Thoughts @aduth and others?
referenced this issue
Sep 25, 2018
That's true. I think we can provide a less than ideal fix for now until the root issue (which requires a big refactoring) is addressed.
What we can do right now, is to use an error boundary around the preview component as it should possible to use the style variation without the need to preview it.
changed the title
Error with style variants applied to the block (parent) with InnerBlocks inside (Cannot read property 'innerBlocks' of null)
Nov 12, 2018
This was referenced
Nov 12, 2018
I'd really love to see a fix for this. Adding styles to blocks with
If there is anything I can do to get my hands dirty and help address this, please let me know--I'd love to help out.
Is the problem just with the little previews that display in the Inspector? Those make a lot of sense for things like buttons, but not-so-much for large blocks.
Maybe the simplest solution would just be to have an option to disable/customize the previews in the style selector, as opposed to refactoring InnerBlocks.
I would be fine with just having a fallback vanilla radio input or dropdown… after all the user will see the effects in the editor anyway.
Error when clicking on Style Panel.
Right. Here's an example of some code in an edit function that I used:
There may be a better way to do it, but that's what worked for me.