18 Apr

ACF Chat Fridays: Reusable Blocks, Performance, and WPGraphQL

By Mike Davey

Questions about ACF? Want to know what’s coming next, or how to build the best sites you can? Then make sure you attend ACF Chat Fridays, our open office hours with the ACF team and users. Keep reading for a recap of the latest session.

The April 14th session covered questions about reusable blocks, pre-loading, and WPGraphQL for ACF.

Co-hosted by Liam Gladdy and Anthony Burchell.

Sign up for the next session →

ACF Chat Fridays Banner Image.

Catch All the Action

Missed the last session? No worries. We’ve got you covered with the video replay below, or read the highlights in the session summary

Session Summary

Liam Gladdy led off the April 14th session to issue an open call for translators to work on ACF 6.1. The latest release nearly doubles the number of strings requiring translation. Liam thanked all of those who have already contributed to the translation effort.

“People have been really quick at jumping on top of that,” he said. “We’ve got 100% now in Portuguese, Spanish, and Dutch, and everything else is ticking up nicely.”

Liam also took a moment to acknowledge ACF’s recent win in Torque’s Plugin Madness. Our sincere thanks to all of you who voted for ACF and helped us take the 2023 championship title.

Every ACF Chat Friday gives you the opportunity to ask the ACF team questions about technical challenges and the best way to achieve a specific objective. We’ve included just a few of the questions and answers below. Minor edits have been made for clarity and style.

Q: If a page consists of many reusable blocks, the backend editor takes a long time to load, because all the reusable blocks are loaded asynchronously. Is there a way to render the reusable blocks server-side like all the other non-reusable blocks on the page, or even to show a placeholder instead of the reusable blocks and only load them on click?

A: We use pre-loading because a lot of web hosts just can’t handle the amount of AJAX calls. However, pre-loading a lot of blocks can cause problems. It might be worth turning off pre-loading with acf_update_setting(‘preload_blocks’, false); and seeing if that helps.

Q: ACF pre-loading only works on the block frontend and not the block fields. Any thoughts on a feature to also server-side pre-load the block fields so when you click them all the fields and settings aren’t loaded via AJAX?

A: In ACF Blocks, we have the block preview and the block form. Those are actually React components, which is why we use those terms. The block form contains the HTML, the select, text input, any prepends, etc. All of that gets rendered as the block form.

We’d like to do more in native React components, which allow actions like getting a JSON list of fields and rendering it in a window on the frontend, rather than rendering it server side. This is something we’d like to improve significantly over the next few months.

Q: When using acf/load_field to populate the values for a Select2, it runs on the frontend and loads the field values on the frontend. This isn’t good for performance if your values are populated via an API or you have a huge list and it’s not needed. Aside from caching, do you have any ways to prevent that from happening?

A: If you’re using a stylized Select2 to style the field, you could make that API call happen as part of the query field rather than the load_field filter. Doing it that way, it will only ever load at the point that the results are queried. You’ll probably still want to cache that with a transient in your code.

The next session of ACF Chat Fridays is scheduled for April 28, 2023, at 2pm GMT.

We share relevant resources during the call. We’ll sum them up here and try to provide a bit of context:

Coming Up on ACF Chat Fridays

Join us on April 28th for the next session of ACF Chat Fridays. This session will take place at 2pm GMT.

What do you think we should cover in upcoming sessions? Let us know what you’d like to see on Twitter.

Sign up for the next session of ACF Chat Fridays here:

https://wpeng.in/acf-chat-fridays/

The list of upcoming sessions is below.

  • April 28, 2023
  • May 12, 2023
  • May 26, 2023
  • June 9, 2023

Tag or DM us on Twitter to let us know you’ll be there. Suggest new topics, let us know what you’d like to see, and send us feedback with #ACFChatFridays on Twitter.

About the Author