-
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
[RNMobile] Add WP hook for registering non-core blocks #52791
[RNMobile] Add WP hook for registering non-core blocks #52791
Conversation
The idea of this hook is to allow non-core blocks to be registered right after the core blocks.
Size Change: +846 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 7fb8ba6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5612814611
|
@@ -70,6 +70,8 @@ const setupInitHooks = () => { | |||
) { | |||
unregisterBlockType( 'core/block' ); | |||
} | |||
|
|||
doAction( 'native.post-register-core-blocks', props ); |
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 double-checked that the props passed here are the ones expected as from the older approach in https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/src/index.js#L57-L66 👍
I was wondering if we should remove the native.render
action or keep it if it's needed in the future, what do you think? I'm fine with keeping it by the way.
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 double-checked that the props passed here are the ones expected as from the older approach in https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/src/index.js#L57-L66 👍
Thanks for checking it 🙇 ! I saw that we only use the capabilities
prop when registering the Jetpack blocks, which is already being passed.
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 was wondering if we should remove the
native.render
action or keep it if it's needed in the future, what do you think? I'm fine with keeping it by the way.
Good question. AFAIK it's not being used anywhere, so I understand we could remove it. If we need it in the future we can always revert it back.
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.
Sounds good to me! Are we planning to do that in a follow-up PR? This PR is ready for my approval so let me know!
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.
Ah, sorry. I'm planning to apply the suggestion in this PR. In fact, I noticed that I missed adding a unit test for the new hook. I'll let you know when I pushed the changes, thanks!
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.
Cool! I'll keep an eye out for those, thanks!
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.
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! I'll check it out
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.
LGTM! It makes sense to trigger this new action right after registering the core blocks 🚀
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.
LGTM! Thanks for quickly fixing this issue and updating the tests! TIL about working with invocationCallOrder
so it was a nice PR to review 🚀
…ding-strategy * origin/trunk: (59 commits) Promisify action creator return type for WP data dispatch (#52530) [RNMobile] Add WP hook for registering non-core blocks (#52791) removes check for active preview device type to enable the fixed toolbar preference (#52770) Enforce checks against redeclaration for functions and classes (#52696) update appearance tools, (#52785) Behaviors: Extend Global Styles API to read/write behaviors config. (#52370) HeaderToolbar - Update inserterMethod meta data (#52735) add options for debugging php unit tests (#52778) Docs: Interactivity API > Getting Started Guide - minor adjustments (#52786) Footnotes: Use static closures when not using '' (#52781) Improve slug generation & matching in request utils (#52414) Open "docs" folder for the Interactivity API package and Getting Started Guide (#52462) Global Styles: Don't use named arguments for 'sprintf' (#52782) E2E utils - Update locator to hide the keyboard on iOS to pick the first element, on iPad two buttons are available and the second one makes the floating keyboard to show up (#52771) Patterns: Reinstate template parts mode spec (#52780) chore(release): publish Update changelog files Patterns: Fix empty general template parts category (#52747) Add id to pattern inserted notice to stop multiple notices stacking (#52746) Site Editor: Fix site link accessibility issues (#52744) ...
What?
Add a WordPress hook to allow non-core blocks to be registered right after core blocks.
Why?
This is needed to address a crash in Gutenberg Mobile.
How?
Add a WordPress hook named
native.post-register-core-blocks
that is executed right after the core blocks register.Testing Instructions
Follow testing instructions from Gutenberg Mobile PR.
Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A