-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Directory: Fix installing blocks #23096
Block Directory: Fix installing blocks #23096
Conversation
A block installation error is now expressed by returning an error response, this means looking for a success property no longer works since we are returning the installed plugin information instead. Also switches to making an OPTIONS request to the search controller instead of making an "empty" search request as a search term is now required.
I was able to fix the unit test error, but I'm struggling to figure out how to fix the end to end test failure. AFAICT, it's breaking here:
I think the search is working. But I don't know how to debug further. |
If you're running it locally, you can use |
Aha! Thanks for the tip @ryelle! Working on a fix. |
Looks like that fixed it, I'm not sure if I went about it the correct way. But I didn't see other examples of mocking headers, and didn't want to touch the |
Test suite is now passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! :)
if ( error.code === 'rest_user_cannot_view' ) { | ||
yield setInstallBlocksPermission( false ); | ||
|
||
let allowHeader; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to have this here until we are out of experimental
status and move to:
gutenberg/packages/core-data/src/resolvers.js
Line 171 in f15b91c
export function* canUser( action, resource, id ) { |
Running it interactively seems to work. There is a warning being thrown failing my tests locally but I don't think its related to the block directory.
|
I got that error message as well. |
packages/e2e-tests/specs/experiments/block-directory-add.test.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good & is working correctly now. FWIW I'm seeing the " React does not recognize the %s
prop on a DOM element" console error on master too, so it's not an issue from this PR.
Description
I broke block directory inserting on master after #22454 was committed. This should fix those errors.
A block installation error is now expressed by returning an error response,
this means looking for a success property no longer works since we are
returning the installed plugin information instead.
Also switches to making an OPTIONS request to the search controller instead
of making an "empty" search request as a search term is now required.
How has this been tested?
Tested manually by opening the block directory inserter, searching for "peculiar" and installing the returned block.
Types of changes
Bug Fix
Checklist: