Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#53136 new defect (bug)

Error with "Add to Reusable blocks" in WordPress 5.7.1

Reported by: sawamura's profile sawamura Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.7.1
Component: Editor Keywords: reporter-feedback needs-testing
Focuses: Cc:

Description

Error when "adding the first paragraph style to the reuse block" in a new post with core/paragraph added (or used) in register_block_style() in WordPree 5.7.1 The error message is

Error statement
The editor has encountered an unexpected error

Additional code (functions.php / Theme: Twenty Twenty-One)

<?php
register_block_style(
'core/paragraph',
array(
'name' => 'blue-paragraph',
'label' => __( 'Blue paragraph' ),
'inline_style' => '.is-style-blue-paragraph { color: blue; }',
)
);

https://f.easyuploader.app/20210503102556_54394978.gif
https://f.easyuploader.app/20210503102810_6e724b33.png

Change History (7)

This ticket was mentioned in Slack in #core by chaion07. View the logs.


3 years ago

#2 @poena
3 years ago

I can reproduce this with WordPress 5.7.2 (no plugins active), but inconsistently. Sometimes, there is no error.

With no block style applied, I sometimes run into this JavaScript error:

TypeError: onCopy is not a function
    at http://localhost:8888/wp-includes/js/dist/components.js?ver=05cdf30cf2623cd4539a5c19832b0114:28335:7
    at commitHookEffectListMount (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:19866:28)
    at commitPassiveHookEffects (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:19904:13)
    at HTMLUnknownElement.callCallback (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:182:16)
    at Object.invokeGuardedCallbackDev (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:231:18)
    at invokeGuardedCallback (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:286:33)
    at flushPassiveEffectsImpl (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:22988:11)
    at unstable_runWithPriority (http://localhost:8888/wp-includes/js/dist/vendor/react.js?ver=16.13.1:2685:14)
    at runWithPriority$1 (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:11174:12)
    at flushPassiveEffects (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:22955:14)

If I add the style either before or after turning it into a reusable block, I am seeing the following
JavaScript error:

    Error: An error occurred while running 'mapSelect': Cannot read property 'name' of null
The error may be correlated with this previous error:
TypeError: Cannot read property 'name' of null
    at Object.selector [as current] (http://localhost:8888/wp-includes/js/dist/block-editor.js?ver=4378547cec8f5157a02ead3dfc5c65b2:23681:71)
    at http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:3798:36
    at __experimentalMarkListeningStores (http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:2926:27)
    at Object.__experimentalMarkListeningStores (http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:2988:30)
    at http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:3747:21
    at onStoreChange (http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:3797:30)
    at onChange (http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:3826:9)
    at http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:2415:13
    at Object.dispatch (http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:1165:7)
    at dispatch (<anonymous>:3856:17)

Original stack trace:
    at useSelect (http://localhost:8888/wp-includes/js/dist/data.js?ver=943087ae96d075f126df689839bb96b9:3772:13)
    at BlockStyles (http://localhost:8888/wp-includes/js/dist/block-editor.js?ver=4378547cec8f5157a02ead3dfc5c65b2:23690:58)
    at renderWithHooks (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:14938:20)
    at updateFunctionComponent (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:17169:22)
    at beginWork (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:18745:18)
    at HTMLUnknownElement.callCallback (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:182:16)
    at Object.invokeGuardedCallbackDev (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:231:18)
    at invokeGuardedCallback (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:286:33)
    at beginWork$1 (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:23338:9)
    at performUnitOfWork (http://localhost:8888/wp-includes/js/dist/vendor/react-dom.js?ver=16.13.1:22289:14)

#3 @peterwilsoncc
3 years ago

  • Milestone changed from Awaiting Review to 5.7.3

Hi @sawamura and welcome to trac!

Thanks for the report, I'm moving this on to the 5.7.3 milestone for visibility. It was discussed in a triage session today and a couple of attendees could reproduce the error.

#4 @SergeyBiryukov
3 years ago

  • Summary changed from Error with "Add to Reuse Block" in WordPree 5.7.1 to Error with "Add to Reusable blocks" in WordPress 5.7.1

#5 @SergeyBiryukov
3 years ago

Hi there, welcome to WordPress Trac! Thanks for the report.

Just linking to some tickets here that might be related: #52779, #52790, #52918, #52965.

#6 @desrosj
3 years ago

  • Milestone changed from 5.7.3 to 5.8.1

With 5.8 RC1 due out next week and no 5.7.3 currently planned, I'm going to punt this to the milestone for the next minor release: 5.8.1.

#7 @desrosj
3 years ago

  • Keywords reporter-feedback needs-testing added
  • Milestone changed from 5.8.1 to Future Release

5.8.1 RC is due out in less than 24 hours and this one has not received any attention in the last few months. I'm going to punt this to Future Release.

Since this ticket was created, WordPress 5.8 was released. Some additional testing to confirm the issue still happens in the latest version of WordPress, and then confirming all of the conditions required to reproduce would be the next steps here.

Note: See TracTickets for help on using tickets.