Skip to content

Block Directory: Throw error if we have an issue registering blocks. - #23439

Merged
ryelle merged 12 commits into
masterfrom
fix/block-directory-show-registration-error
Jul 3, 2020
Merged

ryelle merged 12 commits into
masterfrom
fix/block-directory-show-registration-error

Conversation

@StevenDufresne

@StevenDufresne StevenDufresne commented Jun 25, 2020 •

Copy link
Copy Markdown
Contributor

Description

When a third party block fails during the installation process, we should alert the user to give them context.

How has this been tested?

  1. Search for "Waves" -> At the time of the PR, that block is currently breaking (but probably fixed by now)
  2. Click 'Add Block'
  3. Expect to see an error messages below:

Types of changes

  1. Update the structure of Error Notice state.
  2. Change button toreload from retry if error is known to be fatal.
  3. Specifically handle API errors folder_exists, unable_to_connect_to_filesystem.

Assumptions

This PR doesn't try to handle all the use cases but instead identifies the ones we know to be fatal or introduce and awkward experience. All other unhandled but thrown errors will allow user's the opportunity to retry.

Screenshots

Already Installed Failed Install Failed Registration
Error msg Error msg Error msg
Note: Probably should add more error code handling. Currently only unable_to_connect_to_filesystem

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@StevenDufresne StevenDufresne added [Type] Bug An existing feature does not function as intended [Feature] Block Directory Related to the Block Directory, a repository of block plugins labels Jun 25, 2020
@StevenDufresne
StevenDufresne requested a review from ryelle June 25, 2020 03:11
@github-actions

github-actions Bot commented Jun 25, 2020 •

Copy link
Copy Markdown

Size Change: +303 B (0%)

Total Size: 1.13 MB

Filename Size Change
build/block-directory/index.js 7.74 kB +321 B (4%)
build/block-editor/index.js 109 kB -18 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.62 kB 0 B
build/api-fetch/index.js 3.4 kB 0 B
build/autop/index.js 2.82 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/style-rtl.css 941 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/style-rtl.css 10.7 kB 0 B
build/block-editor/style.css 10.7 kB 0 B
build/block-library/editor-rtl.css 7.63 kB 0 B
build/block-library/editor.css 7.63 kB 0 B
build/block-library/index.js 129 kB 0 B
build/block-library/style-rtl.css 7.79 kB 0 B
build/block-library/style.css 7.79 kB 0 B
build/block-library/theme-rtl.css 730 B 0 B
build/block-library/theme.css 732 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 48.2 kB 0 B
build/components/index.js 198 kB 0 B
build/components/style-rtl.css 15.9 kB 0 B
build/components/style.css 15.9 kB 0 B
build/compose/index.js 9.65 kB 0 B
build/core-data/index.js 11.4 kB 0 B
build/data-controls/index.js 1.29 kB 0 B
build/data/index.js 8.44 kB 0 B
build/date/index.js 5.47 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 569 B 0 B
build/dom/index.js 3.19 kB 0 B
build/edit-navigation/index.js 9.88 kB 0 B
build/edit-navigation/style-rtl.css 1.02 kB 0 B
build/edit-navigation/style.css 1.02 kB 0 B
build/edit-post/index.js 304 kB 0 B
build/edit-post/style-rtl.css 5.51 kB 0 B
build/edit-post/style.css 5.51 kB 0 B
build/edit-site/index.js 16.6 kB 0 B
build/edit-site/style-rtl.css 3 kB 0 B
build/edit-site/style.css 3 kB 0 B
build/edit-widgets/index.js 9.32 kB 0 B
build/edit-widgets/style-rtl.css 2.42 kB 0 B
build/edit-widgets/style.css 2.42 kB 0 B
build/editor/editor-styles-rtl.css 537 B 0 B
build/editor/editor-styles.css 539 B 0 B
build/editor/index.js 44.9 kB 0 B
build/editor/style-rtl.css 3.85 kB 0 B
build/editor/style.css 3.86 kB 0 B
build/element/index.js 4.65 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.72 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 2.13 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.56 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.52 kB 0 B
build/keycodes/index.js 1.94 kB 0 B
build/list-reusable-blocks/index.js 3.12 kB 0 B
build/list-reusable-blocks/style-rtl.css 450 B 0 B
build/list-reusable-blocks/style.css 451 B 0 B
build/media-utils/index.js 5.29 kB 0 B
build/notices/index.js 1.79 kB 0 B
build/nux/index.js 3.4 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.56 kB 0 B
build/primitives/index.js 1.5 kB 0 B
build/priority-queue/index.js 788 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 14 kB 0 B
build/server-side-render/index.js 2.67 kB 0 B
build/shortcode/index.js 1.69 kB 0 B
build/token-list/index.js 1.28 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.85 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@StevenDufresne StevenDufresne changed the title Throw error if we have an issue registering blocks. Block Directory: Throw error if we have an issue registering blocks. Jun 25, 2020
@tellyworth

Copy link
Copy Markdown
Contributor

I wonder if we should maybe create a fatal error state that doesn't allow retries?

I think so, yes. If it's a problem that we know can't be solved by retrying then that's a better experience. Ideally we shouldn't return broken blocks in search results in the first place, but it makes sense to have a way of handling them.

@StevenDufresne

Copy link
Copy Markdown
Contributor Author

@ryelle What are your thoughts here?

I don't want to invest too much time in this direction if we think there's a better approach (which is why this is still draft).

@ryelle

ryelle commented Jun 30, 2020

Copy link
Copy Markdown
Contributor

I think you're on the right track. Maybe you could show a "reload" button instead of "retry" for these kinds of errors? If it's not a hassle - ideally this situation would be very rare, since the wp.org block validation should catch these errors before the blocks get added to the directory, right?

@StevenDufresne
StevenDufresne marked this pull request as ready for review July 1, 2020 06:39

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not set a bottom margin on block-directory-downloadable-block-notice__content?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch. This was from the iteration where the button didn't exist if fatal. Now we always persist a button (reload btn now), so I'll revert back.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally avoid abbreviated variable names, so this can be message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sounds good.

@ryelle

ryelle commented Jul 1, 2020

Copy link
Copy Markdown
Contributor

I added 2a28f968daced4ad3e7f5fda6bbc52375638d197 to disable the "Add Block" button when a block has a fatal notice, and ad5e50c1c43274a1485291d8522d3b5ea5609274 to clean up the error messages a bit.

@ryelle

ryelle commented Jul 1, 2020

Copy link
Copy Markdown
Contributor

It also looks like the tests need to be updated, or the clearErrorNotice should go back to setting notice to false. Removing that item from the notice state would probably be a cleaner solution, if you do want to change clearErrorNotice.

@StevenDufresne

Copy link
Copy Markdown
Contributor Author

It also looks like the tests need to be updated, or the clearErrorNotice should go back to setting notice to false. Removing that item from the notice state would probably be a cleaner solution, if you do want to change clearErrorNotice.

Yep, will get to those today.

@StevenDufresne
StevenDufresne force-pushed the fix/block-directory-show-registration-error branch from ad5e50c to 7b43fca Compare July 2, 2020 04:52

@ryelle ryelle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Fixes the issue with errors we can detect, so this is a good improvement.

@ryelle
ryelle merged commit f14005a into master Jul 3, 2020
@ryelle
ryelle deleted the fix/block-directory-show-registration-error branch July 3, 2020 18:51
@github-actions github-actions Bot added this to the Gutenberg 8.5 milestone Jul 3, 2020
@tellyworth tellyworth mentioned this pull request Jul 3, 2020
16 of 20 tasks
@TimothyBJacobs

Copy link
Copy Markdown
Member

Does it make sense to do this for all 500 status code errors? Those should theoretically already denote "fatal" errors, or am I misunderstanding what you mean by fatal in this case.

@StevenDufresne

Copy link
Copy Markdown
Contributor Author

Does it make sense to do this for all 500 status code errors? Those should theoretically already denote "fatal" errors, or am I misunderstanding what you mean by fatal in this case.

No, you are correct. Under a bit of a time crunch, we focused on handling the error cases we saw during third party testing to provide more useful user error messages. We'll follow this up and test more api errors, and most likely cover all 500 cases with 'reload' type error messaging where applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block Directory Related to the Block Directory, a repository of block plugins [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants