For developers of custom Divi modules, here’s a quick tip that may save you some hassle along the way. Divi Builder caches modules in the browser’s local storage to improve performance. However, as a custom module developer, you may find that changes you make to your modules don’t show up during testing – you keep seeing the old cached version. Worse yet, you may try to update the plugin for your users and find that they can’t see your new changes. To avoid this, you can simply clear your module from the cache at the appropriate times.
Divi developer Jonathan Bossenger first raised my awareness of this in his post on the Divi Builder cache.
In the post, he offers a code snippet for clearing the cache:
This is great, but there are a couple of refinements that I think are useful. The first is to clear only the specific module you are working on – this avoids any potential interference with other modules, etc. The second is to actually incorporate the cache clearing code into your plugin and having it run when the user updates the module. This ensures that your changes are immediately visible to the user after updating.
Here is a bit of template code for doing so:
Please note that I pulled this out of my own custom plugin code, but that I haven’t fully tested it in its current form, so please make sure you do and let me know if you spot any errors in it.