Gutenberg: Weird behavior trying to save a WordPress embed as reusable block

Created on 16 Sep 2018  路  7Comments  路  Source: WordPress/gutenberg

Describe the bug
I added a WordPress embed block to my post. It worked. Then I used "add as reusable block", it bypassed the save screen and added it as an "untitled" to the list. Then I tried to add it to a post. The "An error happened screen" appeared. (nice!!)
And I was able to "copy the error" see below.

_NOTE: The error message indicates 3.9 RC, I tested it in 3.8 as well, with the same outcome._

To Reproduce
Steps to reproduce the behavior:

  1. Add a new post
  2. in new line, copy/page URL
  3. save post
  4. Edit Post
  5. Select block
  6. Use: Add to reusable block.
  7. Remove block from post
  8. Try to add from reusable blocks the "Untitled" block

Expected behavior

  • A save screen to give the reusable block a name
  • when selected add just saved block again into the post.

Video
http://recordit.co/cHJ3ygmpqZ

Desktop (please complete the following information):

  • OS: Mac 10.13.6
  • Browser Chrome
  • Version 68

Error Message
TypeError: this.props.onReplace is not a function
at r.value (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/build/block-library/index.js?ver=1537102276:12:86194)
at new r (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/build/block-library/index.js?ver=1537102276:12:84960)
at yh (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:97:111)
at lg (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:120:88)
at mg (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:120:386)
at gc (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:127:202)
at vb (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:126:230)
at ub (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:126:65)
at ug (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:136:380)
at ue (http://rctesting.local/wp-content/plugins/gutenberg-3.9-RC/vendor/react-dom.min.82e21c65.js:25:80)

[Feature] Reusable Blocks [Type] Bug

Most helpful comment

...and 2 minutes after I posted that, I think I found a fix :)

All 7 comments

Seems to be specific to WordPress embeds. Twitter worked ok.

There are also some yucky rendering issues with reusable embed blocks. Time to dive into the implementation..!

This is a deeper issue with WordPress embeds, how we detect them and make sure the correct embed block is used, and how the JavaScript that does the embedding gets loaded. It's... not straightforward.

I am drinking lots of coffee, put it that way :rofl:

Some progress, some... not progress.

I have a fix for the WordPress embed block - that's good!

The reusable blocks are only meants for static content - that's not so good! Because it means that when a reusable block is used in a post, the content doesn't get any further processing. So the URL you embed doesn't get processed, and the content doesn't embed, it just shows the URL on the page.

I'll continute investigating to see if there's anything we can do to fix this, but at this point having read the code, it seems that reusable blocks are for static content only.

I'll update here once I know more.

...and 2 minutes after I posted that, I think I found a fix :)

@designsimply thanks! The PR that fixes this has a conflict, I'll fix that first thing tomorrow and request a core review :)

PR conflict is resolved. @bph the fix is up for review by the core team now, so hoping this should be fixed very soon :)

Was this page helpful?
0 / 5 - 0 ratings