Skip to content
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

Crash adding style to Columns block with registerBlockStyle #10148

Closed
joemaller opened this issue Sep 25, 2018 · 3 comments
Closed

Crash adding style to Columns block with registerBlockStyle #10148

joemaller opened this issue Sep 25, 2018 · 3 comments
Labels
Needs Technical Feedback Needs testing from a developer perspective.

Comments

@joemaller
Copy link
Contributor

Describe the bug
Trying to apply the wp.blocks.registerBlockStyle filter to the core/columns block crashes the editor when trying to open the style selector.

Tested with Gutenberg 3.9.0 on WordPress 4.9.8.

To Reproduce
Steps to reproduce the behavior:

  1. Include this JS snippet somewhere:
wp.blocks.registerBlockStyle("core/columns", {
  name: "column-wrap",
  label: "Wrap Columns",
});
  1. Add a Columns block to the editor
  2. Select the Columns block, click the Block Style selection button
  3. Editor crashes on click

Expected behavior
registerBlockStyle should be able to filter core/columns/ just like any other block.

Screenshots
registerblockstyle-crash

Desktop (please complete the following information):

  • OS: macOS 10.13.6, Windows 10 Pro v1803
  • Browsers/versions:
    • Chrome 69.0.3497.100
    • Edge 42.17134
    • Safari 12.0 (13606.2.11)

Error text, copied from browser

TypeError: Cannot read property 'innerBlocks' of null
    at t.value (http://iop.test/wp-content/plugins/gutenberg/build/editor/index.js?ver=1537547977:50:134123)
    at t.value (http://iop.test/wp-content/plugins/gutenberg/build/editor/index.js?ver=1537547977:50:133797)
    at commitLifeCycles (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:14939:22)
    at commitAllLifeCycles (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:16040:7)
    at HTMLUnknownElement.callCallback (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:140:14)
    at Object.invokeGuardedCallbackDev (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:178:16)
    at invokeGuardedCallback (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:227:29)
    at commitRoot (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:16181:7)
    at completeRoot (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:17196:34)
    at performWorkOnRoot (http://iop.test/wp-content/plugins/gutenberg/vendor/react-dom.24169eaf.js:17141:9)
@joemaller joemaller changed the title Crash adding style to Columns block Crash adding style to Columns block with registerBlockStyle Sep 25, 2018
@designsimply designsimply added the Needs Technical Feedback Needs testing from a developer perspective. label Sep 25, 2018
@joemaller
Copy link
Contributor Author

This looks like a bigger issue with style previews and InnerBlocks. I just tried adding styles to a clone of Columns and the editor crashed the same as above. Using wp.blocks.registerBlockStyle is probably the fastest way of revealing the problem and a decent isolation of the problem.

This should probably be renamed Editor crash with InnerBlocks and Block Styles?

@joemaller
Copy link
Contributor Author

Very much related: #9897

@youknowriad
Copy link
Contributor

Yes closing as duplicate of #9897

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Technical Feedback Needs testing from a developer perspective.
Projects
None yet
Development

No branches or pull requests

3 participants