Wp-calypso: Unable to Export Reusable Blocks

Created on 29 Jan 2020  路  10Comments  路  Source: Automattic/wp-calypso

Steps to reproduce

  1. On any non-AT WordPress.com site, create a Reusable Block: https://en.support.wordpress.com/wordpress-editor/blocks/reusable-block/
  2. Visit /wp-admin/edit.php?post_type=wp_block on that site.
  3. Attempt to choose "Export as JSON" for any block.
  4. Notice that nothing happens.

What I expected

Under WordPress 5.3.2, the browser's download prompt appears.

What happened instead

Under any non-AT WordPress.com site, nothing happens.

Browser / OS version

macOS 10.15.3, reproduced under Firefox 72.0.2, Safari 13.0.5, and Chrome 79.0.3945.130.

Screenshot / Video

Screen Shot 2020-01-29 at 11 09 18

Context / Source

Reported via https://en.forums.wordpress.com/topic/in-the-reusable-blocks-editor/

Blocks [Goal] Gutenberg [Pri] Low [Type] Bug

All 10 comments

Confirmed I can still reproduce this issue on a Premium site in Chrome 79.0.3945.13

Still reproing as of today. Adding a screenshot of the console and moving onto another board.
image

@sirreal if doesn't fall within your teams purview, let me know!

I took a quick look at this. I've added it to the create maintenance board because it's a bug and not strictly related to editor integration.

@macmanx2 or @kriskarkoski do you have an idea of how big the impact is here? As far as I can tell you must manually introduce this URL to reach the page. Are users encountering this issue? Do you know how the page can be reached?

This is caused by an issue with public-api. There is a request triggered to https://public-api.wordpress.com/wp/v2/types/wp_block?_locale=user that fails with the following error:

Access to fetch at 'https://public-api.wordpress.com/wp/v2/types/wp_block?_locale=user' from origin 'https://example.wordpress.com' has been blocked by CORS policy: Request header field x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response.

There are a few problems with the request:

  • The URL should include the site fragment. https://public-api.wordpress.com/wp/v2/types/wp_block?_locale=user should be https://public-api.wordpress.com/wp/v2/sites/[[ SITE_ID ]]/types/wp_block?_locale=user.
  • The x-wp-nonce header either should not be provided (it doesn't seem necessary) or it should be allowed on these requests by Access-Control-Allow-Headers.

Update: We have wpcomFetchAddSitePrefix that helps handle these apiFetch calls from the block editor. It may be a helpful place to start looking around.

Given the lack of additional reports I'd say the impact is minimal (I tested as part of a bug sweep for HACK week) since no additional reports have come in here in almost 9 months.

Thank you @kriskarkoski Do you know if you can get to this page via the UI?

@cathymcbride I do not know of way to access it in the UI. I was thinking there was a blog RC option, but it seems that "Don't redirect WP-Admin importers to Calypso" only applies to imports, not exports.

OK - in that case I'm going to leave it at low pri for the moment, since it's quite hard to get to.

Cool, I agree with it being low priority, possibly even wontfix if it works or is hidden from being accessible from the UI

I think it's fairly unlikely that users will get there this way, but to get there via the UI, you can:

  1. From Calypso on your site click the link to go to wp-admin.
  2. Go to any post
  3. Create a re-usable block, then from the left hand inserter, select the Reusable tab, then click on Manage all reusable blocks:

image

I agree it's low-priority though, so I'll place it at the bottom of the prioritised backlog for now.

Was this page helpful?
0 / 5 - 0 ratings