Gutenberg: Creating dynamic blocks tutorial broken

Created on 22 May 2019  路  4Comments  路  Source: WordPress/gutenberg

Describe the bug
The code is broken without adding the save function to the dynamic block:
https://developer.wordpress.org/block-editor/tutorials/block-tutorial/creating-dynamic-blocks/

Under ES5 code sample, you need to add:

save: function() {
            return null;
        }

After this function:

( function( props ) ..

Otherwise chrome console displays:
blocks.min.js?ver=6.2.5:2 The "save" property must be specified and must be a valid function.

Expected behavior
News block to show up in editor/insertor.

Desktop (please complete the following information):
Just tried on chrome( Version 74.0.3729.131 (Official Build) (64-bit ), windows 10, desktop

Additional context

  • Using latest Gutenberg version that comes with latest wordpress core 5.2.1
[Status] Not Implemented [Type] Documentation

Most helpful comment

I see this has been merged but the website still is wrong. Is there a tutorial that is actually reflective of the current api? If so, where do I find it?

Also, since the website is incorrect and has been it seems for several months it should be clearly marked as such to avoid occurrences like I'm encountering where I spend 2+hours trying to find what is wrong with the docs

All 4 comments

@nosolosw or @chrisvanpatten - are we using wp/5.2 branch on https://developer.wordpress.org/block-editor/tutorials/block-tutorial/creating-dynamic-blocks/? It looks like it is synced with the master branch where you can omit save and it will provide the default implementation which returns null.

It clearly isn't serving wp/5.2 as save function is present in the example. This needs to be fixed.

@LukaszJaro - thanks for reporting. Docs themselves are all good, no action is required. I will open a follow-up issue to fix the website which serves them to pick the proper version.

Related issue #14303, and ticket in Trac: https://meta.trac.wordpress.org/ticket/4244.

I see this has been merged but the website still is wrong. Is there a tutorial that is actually reflective of the current api? If so, where do I find it?

Also, since the website is incorrect and has been it seems for several months it should be clearly marked as such to avoid occurrences like I'm encountering where I spend 2+hours trying to find what is wrong with the docs

Was this page helpful?
0 / 5 - 0 ratings