Ensuring extensions/blocks do not inadvertently register twice#11618
Ensuring extensions/blocks do not inadvertently register twice#11618
Conversation
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: April 2, 2019. |
Co-Authored-By: gititon <gititon@users.noreply.github.com>
| // Checking whether block is registered to ensure it isn't registered twice. | ||
| if ( Jetpack_Gutenberg::is_registered( $slug ) ) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
The thing is, this sort of check is kinda what register_block_type() does, and what results in the warning that we're trying to fix here (#11590) 😅 So in a way, we're just cutting in line before that check to silence that warning, when the underlying issue is that some consumer registers a block twice (which it shouldn't). So ideally, we'd find out what consumer that is and change it accordingly 😬
There was a problem hiding this comment.
ideally, we'd find out what consumer that is and change it accordingly
There is a use-case here for example:
#11506 (comment)
There was a problem hiding this comment.
Seems like both are valid concerns but given the time constraints, this seems like a valid way to go for now?
|
Caution: This PR has changes that must be merged to WordPress.com |
jeherve
left a comment
There was a problem hiding this comment.
I'll let @ockham chime in with his opinion since he commented here:
https://github.com/Automattic/jetpack/pull/11618/files#r267412770
Until then, just a minor nitpicking / editor shouting.
Co-Authored-By: kraftbj <public@brandonkraft.com>
ockham
left a comment
There was a problem hiding this comment.
I'll let @ockham chime in with his opinion since he commented here:
https://github.com/Automattic/jetpack/pull/11618/files#r267412770
I had another look at @simison's great analysis at #11590 and commented there: #11590 (comment)
tl;dr: Let's go with this approach for now 😄
* Initial Changelog for 7.2 * Testing list: add mention of IE11 testing * Initial Changelog for 7.2 * Testing list: add mention of IE11 testing * Add CL for #11224 * Add CL for #11426 * Add CL for #11442 * Add testing instructions for #11224 * Add CL for #11451 * Reclassify CL item * Add testing instructions for #11451 * Add CL for #11486 * Add CL for #11418 * Add CL for #11524 * Add CL and testing instructions for #11449 * Add CL for #11460 * Add CL for #11520 and #11582 * Add CL for #11531 * Add CL #11644 * Add testing instructions for #11644 * Add testing instructions for #11644 * Add CL for #11618 * Uniform changelog lines * CL #11679 * CL #11661 * CL #11654 * CL #11645 * CL #11643 * CL #11636 * CL #11635 and for other PHPCS commits * CL #11627 * CL #11626 * CL #11598 * CL #11596 * Remove nested items for shortcopy. I don't believe the detailed list is helpful * CL #11570 * CL #11569 * CL #11560 * CL #11558 * CL #11555 * CL #6704 * CL #11298 * CL #11324 * CL #11443 * CL #11484 * CL #11516 * CL #11529 * Expand Ads block enhancement CL item
This PR ensures extensions/blocks cannot be registered more than once.
Fixes #11590
Fixes #11506
Changes proposed in this Pull Request:
Will not register an extension/block if it's already registered.
Testing instructions:
See #11590 (comment)
Also, an additional phpunit test checks this functionality
Proposed changelog entry for your changes:
No changelog entry needed