Closed chvillanuevap closed 1 year ago
For now my patch is to remove the Sensei blocks from the function calls.
add_filter( 'pum_block_editor_popup_trigger_excluded_blocks', 'courier_remove_popup_trigger' );
function courier_remove_popup_trigger( array $excluded_blocks ) : array {
$excluded_blocks[] = 'sensei-lms/quiz';
$excluded_blocks[] = 'sensei-lms/lesson-actions';
$excluded_blocks[] = 'sensei-lms/button-view-quiz';
$excluded_blocks[] = 'sensei-lms/quiz-question';
$excluded_blocks[] = 'sensei-lms/quiz-question-feedback-correct';
$excluded_blocks[] = 'sensei-lms/question-answers';
$excluded_blocks[] = 'sensei-lms/question-description';
return $excluded_blocks;
}
add_action( 'wp_loaded', 'courier_add_attributes_to_registered_blocks', PHP_INT_MAX );
function courier_add_attributes_to_registered_blocks() : void {
global $wp_version;
if ( version_compare( $wp_version, '5.0' ) === -1 ) {
return;
}
$registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
foreach ( $registered_blocks as $block ) {
$has_sensei_block = str_contains( $block->name, 'sensei-lms' ) || str_contains( $block->name, 'sensei-pro' );
if ( $has_sensei_block ) {
unset( $block->attributes['openPopupId'] );
}
}
}
I'm closing this issue. It seems the problem lies with Sensei LMS. Any plugin that inserts a panel to deal with attributes causes the infinite loop.
Thanks for letting us know.
Description
This is a weird bug and I'm not exactly sure why it is happening. It might be related to https://github.com/WordPress/gutenberg/issues/16850 and #868. Updating a Lesson post from Sensei LMS Pro while Popup Maker is active causes an infinite loop.
Step-by-step reproduction instructions
Steps to reproduce:
When Popup Maker is not active, the post updates and everything is fine. However, when Popup Maker is active, the Update button gets caught in an infinite loop. See GIF below:
I dequeued every single Popup Maker script and the issue persisted. I removed the Popup Control panel and it made no difference. What finally worked was a combined PHP + JS approach, where I commented out the
PUM_Admin_BlockEditor::add_attributes_to_registered_blocks
method and used thepum_block_editor_popup_trigger_excluded_blocks
filter to remove all Sensei LMS blocks. I'm still not sure why it's happening as my experience with Gutenberg is limited. However, it might be a good idea to add thepum_block_editor_popup_trigger_excluded_blocks
filter to thePUM_Admin_BlockEditor::add_attributes_to_registered_blocks
method as well.Environment info
WordPress version: 6.3 PHP version: 7.4.30 (also tested on 8.1.9) Popup Maker version: 1.18.2 Sensei LMS Pro version: 4.16.1
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated.
Yes