Loading

Last modified:

Blockstudio blocks are dynamic, meaning that they must be rendered on the server to be displayed in Gutenberg. This rendering is facilitated by a fetch call to the Blockstudio block renderer. Upon first opening the editor, each block fetches its respective template, which results in multiple requests depending on the number of blocks present on the page.

On some hosts, this can cause timeouts and errors while loading other essential assets needed for the editor to function properly.

Disabling

Rendering template loading can be disabled by setting the disableLoading key in block.json to true. A placeholder will be rendered in place of the block template. All field settings will still be available when opening the sidebar.

block.json

            {
      "name": "blockstudio/native",
      "title": "Native Block",
      "category": "text",
      "icon": "star-filled",
      "description": "Native Blockstudio block.",
      "blockstudio": {
        "blockEditor": {
            "disableLoading": true
          }
        }
      }
    }

      
Copy

Alternatively, block loading can be disabled globally using the settings/blockEditor/disableLoading filter.

blockstudio.json

                {
  "blockEditor": {
    "disableLoading": false
  }
}

      
Copy
functions.php

              add_filter('blockstudio/settings/blockEditor/disableLoading', function() {
    return false;
  });

      
Copy

Preloading

This feature is currently in beta and may not function as expected.

As of Blockstudio version 5.4.8, we have introduced a feature flag that will preload all block templates where feasible. Currently, blocks containing InnerBlocks or inside other blocks will still require client-side fetching.

To activate this feature, insert the following code into your theme or plugin:

functions.php

            const BLOCKSTUDIO_PRELOAD_BLOCKS = true;

      
Copy