Support

Account

Home Forums Gutenberg Empty Data Fields in ACF Gutenberg Blocks

Unread

Empty Data Fields in ACF Gutenberg Blocks

  • I’ve built a number of custom blocks and I’ve noticed when copy/pasting them from the editor that data fields are always included even if they are empty or still have their default value. Below is an example where I’ve changed the field names to make it more readable but the point is that none of those values differ from the defaults set in ACF yet all fields are still being written. This is a very basic example but I have other blocks with a large number of fields with a value that is often “” or where the default remains unchanged.

    <!-- wp:acf/test-block {"name":"acf/test-block","data":{"field_heading":"Block Heading","field_sub_heading":"", "field_image":"", "field_gap":"40px", "field_show_button":"1", "field_link":{"title":"","url":"","target":""}},"mode":"preview"} -->

    This is obviously in contrast with core blocks where there is only a value if settings differ from the default.

    <!-- wp:paragraph -->
    <!-- wp:paragraph {"align":"center"} -->

    My question is: do these empty fields affect performance? My custom ACF blocks do seem to take longer to load in the editor especially if there is a custom block inside another custom block. And if this is what’s slowing them down, is there any way I can set up the blocks up to improve load times? I’ve noticed that if I use conditional logic to only show fields under certain circumstances the data fields aren’t included (setting Show Button to False results in the Link field not being displayed in the data).

    <!-- wp:acf/test-block {"name":"acf/test-block","data":{"field_heading":"Block Heading","field_sub_heading":"", "field_image":"", "field_gap":"40px", field_show_button":"0", "mode":"preview"} -->

    The blocks load fine on the front end but I would like to speed them up in the editor if at all possible.

    Many thanks,
    Kevin

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.