bobbingwide / oik-blocks

WordPress 5.0 blocks for oik shortcodes
https://oik-plugins.com/oik-plugins/oik-blocks
GNU General Public License v3.0
1 stars 0 forks source link

Block inserter - The editor has encountered an unexpected error - Chrome problem #28

Closed bobbingwide closed 4 years ago

bobbingwide commented 5 years ago

I'm raising this here while I figure out if this is a bug with WordPress 5.1 or something else.

Having upgraded to WordPress 5.1.1, I now get problems with Add new. Almost immediately the message box saying "The editor has encountered an unexpected error." appears.

The console log reveals...

Uncaught TypeError: Cannot read property 'prefix/block_name' of undefined
    at getInsertUsage (editor.js:12344)
    at buildBlockTypeInserterItem (editor.js:12493)
    at Array.map (<anonymous>)
    at editor.js:12543
    at callSelector (editor.js:829)
    at runSelector (data.js:709)
    at editor.js:18325
    at getNextMergeProps (data.js:1738)
    at new ComponentWithSelect (data.js:1756)
    at constructClassInstance (react-dom.js:12604)

where prefix/block_name is the name of the Most Used registered block. Sometimes it's oik-block/github, but when I deactivate the plugin that registers it, it's core/paragraph.

The problem is only a problem for one subdomain, in a local installation of wp-a2z.org. The local domain is blocks.wp.a2z

The problem occurs on Chrome Version 73.0.3683.86 (Official Build) (64-bit) It does not happen with Firefox or Edge.

Problem appeared to be resolved after clearing the cache but came back very quickly when I reactivated my own plugin. The block name appearing in the message changed back to "oik-block/github". Previously, when the only routine registering blocks was WordPress core the block name was "core/paragraph".

bobbingwide commented 5 years ago

Reverted to WordPress 5.1 and got the same problem.

bobbingwide commented 5 years ago

Looking at Local storage for https://blocks.wp.a2z I see image

whereas for https://blocks.wp-a2z.org it's image

I don't understand what this data is but I'll delete the local storage in my development server and see if the problem goes away.

bobbingwide commented 5 years ago

The problem is not limited to Chrome and WPMS. I reproduced it on cwiccer.com with Safari on my iPad. I simply deactivated Gutenberg 5.3. Copying and pasting the Error just gives a stack trace, not the error text.

zn@https://cwiccer.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:45350 https://cwiccer.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:46143 map@[native code] https://cwiccer.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:45979 u@https://cwiccer.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:12:3432 https://cwiccer.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:104118 n@https://cwiccer.com/wp-includes/js/dist/data.min.js?ver=4.2.1:1:13037 r@https://cwiccer.com/wp-includes/js/dist/data.min.js?ver=4.2.1:1:13299 zf@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:69:263 Mf@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:87:6 eg@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:309 fg@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:170 wc@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:239 fa@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:117 ng@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:149:71 Se@https://cwiccer.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:40:47 Se@[native code]

bobbingwide commented 5 years ago

I was initially unable to reproduce the problem using Chrome on my iPad. I realised that the problem only occurs after you’ve used Gutenberg 5.3 in the browser of your choice. Gutenberg has to have the opportunity to set Core/block-editor preferences insertUsage to an empty array.

bobbingwide commented 5 years ago

I'm going to leave this open until - retested on 15th Jan

Incidentally, while looking at a problem with the Divi theme I came across a plugin that I could possibly use to fix the issues on my iPad. https://github.com/jonathanbossenger/clear-divi-page-builder-cache

bobbingwide commented 4 years ago

I updated the previous comment. Closing issue now.