• Resolved drsdre

    (@drsdre)


    Crosspost from https://www.ads-software.com/support/topic/wp-5-8-upgrade-gutenberg-insert-block-error-with-yoast/#post-14696450

    Ever since our site has been upgraded to WordPress 5.8, it has become impossible to add new blocks when latest Yoast SEO 16.7 plugin is enabled. The editor fails on a white screen with the message ‘The editor has encountered an unexpected error.’ and the following error:

    TypeError: Cannot destructure property 'categories' of 'Object(...)(...)' as it is undefined.
    at Al (https://mysite.com/wp-includes/js/dist/block-editor.min.js?ver=390a9f83b606a55e8b523c4d16bdb08c:12:182310)
    at xa (https://mysite.com/wp-includes/js/dist/block-editor.min.js?ver=390a9f83b606a55e8b523c4d16bdb08c:12:219203)
    at we (https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:84:293)
    at zj (https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:226:496)
    at Th (https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:152:223)
    at tj (https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:152:152)
    at Te (https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:146:151)
    at https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:61:68
    at unstable_runWithPriority (https://mysite.com/wp-includes/js/dist/vendor/react.min.js?ver=16.13.1:25:260)
    at Da (https://mysite.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:60:280)

    Recovery does work.

    As soon as the Yoast SEO plugin is disabled, the error is gone. Yoast support cannot replicate and help (https://github.com/Yoast/wordpress-seo/issues/17267). When all plugins are disabled and basic Twentytwenty theme and only Yoast plugin enabled, it shows the same behaviour.

    In the Chrome browser console the following errors are shown after clicking the + buttons to add a block:

    data.js?ver=7bfa3a673439e85e459d5ec92d30fdda:3351 An error occurred while running 'mapSelect': Cannot read property 'map' of undefined
    useSelect @ data.js?ver=7bfa3a673439e85e459d5ec92d30fdda:3351
    useBlockTypesState @ block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:18698
    BlockTypesTab @ block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:22475
    renderWithHooks @ react-dom.js?ver=16.13.1:14938
    mountIndeterminateComponent @ react-dom.js?ver=16.13.1:17617
    beginWork @ react-dom.js?ver=16.13.1:18731
    beginWork$1 @ react-dom.js?ver=16.13.1:23314
    performUnitOfWork @ react-dom.js?ver=16.13.1:22292
    workLoopSync @ react-dom.js?ver=16.13.1:22265
    performSyncWorkOnRoot @ react-dom.js?ver=16.13.1:21891
    (anonymous) @ react-dom.js?ver=16.13.1:11224
    unstable_runWithPriority @ react.js?ver=16.13.1:2685
    runWithPriority$1 @ react-dom.js?ver=16.13.1:11174
    flushSyncCallbackQueueImpl @ react-dom.js?ver=16.13.1:11219
    flushSyncCallbackQueue @ react-dom.js?ver=16.13.1:11207
    discreteUpdates$1 @ react-dom.js?ver=16.13.1:22028
    discreteUpdates @ react-dom.js?ver=16.13.1:803
    dispatchDiscreteEvent @ react-dom.js?ver=16.13.1:4291
    data.js?ver=7bfa3a673439e85e459d5ec92d30fdda:3351 An error occurred while running 'mapSelect': Cannot read property 'map' of undefined
    useSelect @ data.js?ver=7bfa3a673439e85e459d5ec92d30fdda:3351
    useBlockTypesState @ block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:18698
    BlockTypesTab @ block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:22475
    renderWithHooks @ react-dom.js?ver=16.13.1:14938
    mountIndeterminateComponent @ react-dom.js?ver=16.13.1:17617
    beginWork @ react-dom.js?ver=16.13.1:18731
    callCallback @ react-dom.js?ver=16.13.1:182
    invokeGuardedCallbackDev @ react-dom.js?ver=16.13.1:231
    invokeGuardedCallback @ react-dom.js?ver=16.13.1:286
    beginWork$1 @ react-dom.js?ver=16.13.1:23338
    performUnitOfWork @ react-dom.js?ver=16.13.1:22292
    workLoopSync @ react-dom.js?ver=16.13.1:22265
    performSyncWorkOnRoot @ react-dom.js?ver=16.13.1:21891
    (anonymous) @ react-dom.js?ver=16.13.1:11224
    unstable_runWithPriority @ react.js?ver=16.13.1:2685
    runWithPriority$1 @ react-dom.js?ver=16.13.1:11174
    flushSyncCallbackQueueImpl @ react-dom.js?ver=16.13.1:11219
    flushSyncCallbackQueue @ react-dom.js?ver=16.13.1:11207
    discreteUpdates$1 @ react-dom.js?ver=16.13.1:22028
    discreteUpdates @ react-dom.js?ver=16.13.1:803
    dispatchDiscreteEvent @ react-dom.js?ver=16.13.1:4291
    block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:18695 Uncaught TypeError: Cannot destructure property 'categories' of 'Object(...)(...)' as it is undefined.
        at useBlockTypesState (block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:18695)
        at BlockTypesTab (block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:22475)
        at renderWithHooks (react-dom.js?ver=16.13.1:14938)
        at mountIndeterminateComponent (react-dom.js?ver=16.13.1:17617)
        at beginWork (react-dom.js?ver=16.13.1:18731)
        at HTMLUnknownElement.callCallback (react-dom.js?ver=16.13.1:182)
        at Object.invokeGuardedCallbackDev (react-dom.js?ver=16.13.1:231)
        at invokeGuardedCallback (react-dom.js?ver=16.13.1:286)
        at beginWork$1 (react-dom.js?ver=16.13.1:23338)
        at performUnitOfWork (react-dom.js?ver=16.13.1:22292)
    useBlockTypesState @ block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:18695
    BlockTypesTab @ block-editor.js?ver=390a9f83b606a55e8b523c4d16bdb08c:22475
    renderWithHooks @ react-dom.js?ver=16.13.1:14938
    mountIndeterminateComponent @ react-dom.js?ver=16.13.1:17617
    beginWork @ react-dom.js?ver=16.13.1:18731
    callCallback @ react-dom.js?ver=16.13.1:182
    invokeGuardedCallbackDev @ react-dom.js?ver=16.13.1:231
    invokeGuardedCallback @ react-dom.js?ver=16.13.1:286
    beginWork$1 @ react-dom.js?ver=16.13.1:23338
    performUnitOfWork @ react-dom.js?ver=16.13.1:22292
    workLoopSync @ react-dom.js?ver=16.13.1:22265
    performSyncWorkOnRoot @ react-dom.js?ver=16.13.1:21891
    (anonymous) @ react-dom.js?ver=16.13.1:11224
    unstable_runWithPriority @ react.js?ver=16.13.1:2685
    runWithPriority$1 @ react-dom.js?ver=16.13.1:11174
    flushSyncCallbackQueueImpl @ react-dom.js?ver=16.13.1:11219
    flushSyncCallbackQueue @ react-dom.js?ver=16.13.1:11207
    discreteUpdates$1 @ react-dom.js?ver=16.13.1:22028
    discreteUpdates @ react-dom.js?ver=16.13.1:803
    dispatchDiscreteEvent @ react-dom.js?ver=16.13.1:4291
    react-dom.js?ver=16.13.1:19662 The above error occurred in the <BlockTypesTab> component:
        in BlockTypesTab (created by InserterMenu)
        in div (created by InserterMenu)
        in div (created by TabPanel)
        in div (created by TabPanel)
        in TabPanel (created by InserterTabs)
        in InserterTabs (created by InserterMenu)
        in div (created by InserterMenu)
        in div (created by InserterMenu)
        in div (created by InserterMenu)
        in InserterMenu (created by InserterLibrary)
        in InserterLibrary (created by InserterSidebar)
        in div (created by InserterSidebar)
        in div (created by InserterSidebar)
        in InserterSidebar (created by Layout)
        in div (created by ForwardRef(InterfaceSkeleton))
        in div (created by ForwardRef(InterfaceSkeleton))
        in div (created by ForwardRef(InterfaceSkeleton))
        in div (created by ForwardRef(InterfaceSkeleton))
        in ForwardRef(InterfaceSkeleton) (created by Layout)
        in Layout (created by Editor)
        in error_boundary_ErrorBoundary (created by Editor)
        in BlockRefsProvider (created by BlockEditorProvider)
        in BlockEditorProvider
        in Unknown (created by Context.Consumer)
        in WithRegistryProvider(BlockEditorProvider) (created by EditorProvider)
        in BlockContextProvider (created by EditorProvider)
        in EntityProvider (created by EditorProvider)
        in EntityProvider (created by EditorProvider)
        in EditorProvider
        in Unknown (created by Context.Consumer)
        in WithRegistryProvider(EditorProvider) (created by Editor)
        in slot_fill_provider_SlotFillProvider (created by Provider)
        in provider_SlotFillProvider (created by Provider)
        in Provider (created by Editor)
        in StrictMode (created by Editor)
        in Editor

    I have tried debugging the Gutenberg React code using define( ‘SCRIPT_DEBUG’, true );. I’m stuck in the execution of BlockTypesTab() => useBlockTypesState() => useSelect() => mapSelect() why registry.select is returning undefined.

    Any help is appreciated.

    Andre

    • This topic was modified 3 years, 4 months ago by drsdre.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support devnihil

    (@devnihil)

    @drsdre We’re sorry to hear you are experiencing this issue on your site.

    If you have confirmed both WordPress, Yoast SEO, and all of your site’s other plugins and themes are up to date and the problem is still occurring even with only a default theme, Yoast SEO, and a new installation of WordPress, this is likely something related specifically to the environment that the WordPress installation is in.

    Can you also please confirm that the environment meets all of the plugin requirements listed here?: https://yoast.com/help/plugin-requirements/

    Thread Starter drsdre

    (@drsdre)

    Setup:
    WP 5.8
    PHP 7.4
    MySQL 8
    Nginx

    Agree, it’s most likely the environment. Unfortunately the error message does not give me enough clues what could could be wrong. I can only determine that when the Yoast plugin is active, the Gutenberg editor ‘Insert block’ functionality completely fails.

    Is there anything in the Yoast plugin that does some trickery with Gutenberg that can cause this issue?

    Andre

    Thread Starter drsdre

    (@drsdre)

    After further deep diving (because try-catch clauses in Gutenberg editor is hiding the actual error occurance), I’m finding a problem with the Yoast Structured Data Blocks functionality:

    TypeError: Cannot read property 'map' of undefined
        at V (https://mysite.com/wp-content/plugins/wordpress-seo/js/dist/structured-data-blocks-1670.js:1:24253)
        at Dt (https://mysite.com/wp-includes/js/dist/blocks.min.js?ver=e2b6602c7ebbe8ce93832ce35d81be1c:2:41651)
        at It (https://mysite.com/wp-includes/js/dist/blocks.min.js?ver=e2b6602c7ebbe8ce93832ce35d81be1c:2:42133)
        at https://mysite.com/wp-includes/js/dist/block-editor.min.js?ver=390a9f83b606a55e8b523c4d16bdb08c:12:128376
        at https://mysite.com/wp-includes/js/dist/hooks.min.js?ver=a7edae857aab69d69fa10d5aef23a5de:2:3910
        at Or (https://mysite.com/wp-includes/js/dist/blocks.min.js?ver=e2b6602c7ebbe8ce93832ce35d81be1c:2:50108)
        at https://mysite.com/wp-includes/js/dist/blocks.min.js?ver=e2b6602c7ebbe8ce93832ce35d81be1c:2:51621
        at Cr (https://mysite.com/wp-includes/js/dist/blocks.min.js?ver=e2b6602c7ebbe8ce93832ce35d81be1c:2:51894)
        at https://mysite.com/wp-includes/js/dist/blocks.min.js?ver=e2b6602c7ebbe8ce93832ce35d81be1c:2:52494
        at Array.reduce (<anonymous>)

    So, as it turns out Gutenberg fails on a missing check for a variable being defined or not in structured-data-blocks-1670.js.

    Original:
    y=n.map((function(e){return Object(s.createElement)(K,a()({},e,{key:e.id}))}));

    Fixed:
    y=n?n.map((function(e){return Object(s.createElement)(K,a()({},e,{key:e.id}))})):null;

    Why this happens on one environment and not another… I don’t know. I guess a variable/setting is not set correctly in this particular environment. Let me know if you know which one this is.

    Could you please have this check implemented on the next version?

    Thanks,
    Andre

    • This reply was modified 3 years, 4 months ago by drsdre.
    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi @drsdre

    Could you add this information (regarding the Yoast structured data blocks possibly causing the issue) to the GitHub issue you’ve already created? Our developers will be able to provide feedback from there.

    Hi, just to add, I have a couple of sites with the same ‘The editor has encountered an unexpected error’ message appearing when trying to edit any existing Post. The error doesn’t appear when editing any Pages.

    Both sites are running the current version of WordPress (5.8) and the error occurs on Yoast version 16.2 onwards.

    One of my sites requires the Gutenberg editor for content layout so I’ve rolled back to Yoast 16.1.1 for now.

    The other site doesn’t require Gutenberg so I’ve installed the Classic Editor plugin and the latest version of Yoast and there is no error when opening Posts.

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi @jamesashcroftgd

    We are sorry you’re having a similar issue. Please open a new request. That way it’s easier to track issues and provide assistance. Thanks!

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WP 5.8 upgrade: Gutenberg insert block error with Yoast’ is closed to new replies.