Support » Alpha/Beta/RC » Custom Block Crashing Block Editor

  • Resolved swift

    (@swift)



    I’ve developed a custom block for the new editor and it works fine with WP 4.9.8 and the Gutenberg plugin v4.1, but when I try it on WP v5.0 (b1 or b2) I get a white screen when I try to edit any post and a bunch of JS errors. If I remove the custom block, the editor works normally in WP5.0. So something has changed while moving from Gutenberg to WP 5.0 that causes issues with my custom block, but I am not familiar enough with all this new JS to debug it. Only one of the errors is connected to my plugin code (conference-scheduler.build.js) and I can’t see why it is an issue looking at the code. The errors are (WP 5.0b2-43845):

    [Error] TypeError: undefined is not an object (evaluating ‘xe.parse’)
    (anonymous function) (blocks.min.js:2:121539)
    r (blocks.min.js:1:149)
    (anonymous function) (blocks.min.js:1:945)
    Global Code (blocks.min.js:1:955)
    [Error] TypeError: undefined is not an object (evaluating ‘wp.blocks.setCategories’)
    Global Code (post.php:94)
    [Log] JQMIGRATE: Migrate is installed, version 1.4.1 (jquery-migrate.min.js, line 2)
    [Error] ReferenceError: Can’t find variable: regeneratorRuntime
    (anonymous function) (api-fetch.min.js:1:3675)
    (anonymous function) (api-fetch.min.js:1:4521)
    r (api-fetch.min.js:1:151)
    (anonymous function) (api-fetch.min.js:1:947)
    Global Code (api-fetch.min.js:1:957)
    [Error] TypeError: undefined is not an object (evaluating ‘wp.apiFetch.use’)
    Global Code (post.php:104)
    [Error] ReferenceError: Can’t find variable: regeneratorRuntime
    (anonymous function) (core-data.min.js:1:5301)
    n (core-data.min.js:1:151)
    (anonymous function) (core-data.min.js:1:947)
    Global Code (core-data.min.js:1:957)
    [Error] ReferenceError: Can’t find variable: regeneratorRuntime
    (anonymous function) (notices.min.js:1:4338)
    r (notices.min.js:1:150)
    (anonymous function) (notices.min.js:1:1564)
    r (notices.min.js:1:150)
    (anonymous function) (notices.min.js:1:1408)
    r (notices.min.js:1:150)
    (anonymous function) (notices.min.js:1:946)
    Global Code (notices.min.js:1:956)
    [Error] ReferenceError: Can’t find variable: regeneratorRuntime
    (anonymous function) (editor.min.js:55:46011)
    (anonymous function) (editor.min.js:55:46941)
    n (editor.min.js:1:149)
    (anonymous function) (editor.min.js:1:945)
    Global Code (editor.min.js:1:955)
    [Error] TypeError: undefined is not an object (evaluating ‘wp.blocks.registerBlockType’)
    (anonymous function) (conference-scheduler.build.js:18:30151)
    n (conference-scheduler.build.js:1:162)
    (anonymous function) (conference-scheduler.build.js:18:33666)
    n (conference-scheduler.build.js:1:162)
    (anonymous function) (conference-scheduler.build.js:1:573)
    Global Code (conference-scheduler.build.js:1:582)
    [Error] TypeError: Object($.withColors) is not a function. (In ‘Object($.withColors)(“backgroundColor”,{textColor:”color”})’, ‘Object($.withColors)’ is an instance of Object)
    (anonymous function) (block-library.min.js:12:10156)
    n (block-library.min.js:1:155)
    (anonymous function) (block-library.min.js:1:951)
    Global Code (block-library.min.js:1:961)
    [Error] TypeError: undefined is not an object (evaluating ‘Object(u.select)(“core/editor”).getBlockSelectionStart’)
    (anonymous function) (edit-post.min.js:12:18838)
    Fe (edit-post.min.js:12:16765)
    INIT (edit-post.min.js:12:18787)
    (anonymous function) (edit-post.min.js:12:66919)
    (anonymous function) (edit-post.min.js:12:19794)
    n (edit-post.min.js:1:151)
    (anonymous function) (edit-post.min.js:1:947)
    Global Code (edit-post.min.js:1:957)
    [Error] TypeError: undefined is not an object (evaluating ‘wp.editPost.initializeEditor’)
    (anonymous function) (post.php:1664)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Marius L. J.

    (@clorith)

    Hiya,

    Does any part of the admin interface load, or does everything crash with a 500 error?

    If it’s a custom block you might, but can’t say for sure without more information, be affected by https://github.com/WordPress/gutenberg/issues/11066

    Visually nothing loads (blank white screen) but inspecting the page it seems pretty well formed with lots of HTML – it’s just that the block editor doesn’t load so nothing shows up. There is no 500 status error – the page loads OK with 200 but then the block editor won’t initialize due to a bunch of errors and so it doesn’t call anything else.

    To reproduce:
    – install “Conference Scheduler” plugin from the directory and activate on WP 5.0
    – try to edit any post/page with the new block editor – new page, existing page, it doesn’t matter – the editor gets JS errors (listed above) and won’t load.

    Maybe there’s some error in my block code, but it runs fine on WP 4.9.8 with Gutenberg plugin 4.1 and lower so it seems more likely it’s caused by WP5.0

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    Have you installed https://en-gb.wordpress.org/plugins/debug-bar/ to test with? It will highlight JS errors a little better.

    Just tried – still nothing. I just get a white screen despite having all the HTML present and the same errors on the console.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    Have you checked your server logs? White Screens are usually a PHP error.

    Nothing in the server logs. As I said, the HTML of the document looks complete (I get the </body></html> tags at the end) so I’m quite sure there is no PHP error – it’s a JS error that blocks the rendering and since the Block Editor is all based on JS, nothing gets rendered.

    FYI I’ve updated to Wp5.0b3 and this issues seems to be resolved. I’ll keep watching it though and report if it reappears. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.