-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 the block activation when metadata registered on server #38697
Conversation
Size Change: +199 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
I see that an unit test is failing. I’m looking into it. |
a625ec1
to
85a35b7
Compare
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've tested a bunch of blocks and everything seems to be working great.
One minor comment about the reduce
function, but if that's a common pattern I'm fine with it 🙂
'styles', | ||
'example', | ||
'variations', | ||
].reduce( ( accumulator, key ) => { |
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.
It took me a minute to parse that this is filtering out response properties - is there a reason we can't use the default response
? or use _fields
when requesting the API endpoint?
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 had a version with _fields
before. I can switch back to it. Do you know how I also get rid of other meta fields like _links
?
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.
Addressed in e19bc49 👍🏻
I noticed that the package already uses loodash
so I went with pick( response, metadataFields )
that should make it easier to read and removes _links
field from the response.
85a35b7
to
e19bc49
Compare
c7fa533
to
5635e3f
Compare
… server (#38697) * Block Directory: Fix the block activation when metadata registered only on server * Add proper mocking for Block Directory unit tests * Handle the case when the block is not registered on the server * Use `_fields` with REST API call and `pick` to filter response
Description
Fixes #38245.
The action that installs the block from Block Directory triggers an additional REST API call to get the corresponding metadata for the newly installed plugin on the server.
Testing Instructions
Step-by-step reproduction instructions
Screenshots
Screen.Recording.2022-02-10.at.11.29.35.mov
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).