Afform - Refresh assetBuilder when saving a form
authorColeman Watts <coleman@civicrm.org>
Thu, 8 Apr 2021 02:33:47 +0000 (22:33 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 8 Apr 2021 03:47:08 +0000 (23:47 -0400)
On sites with caching enabled, changes were not showing until a manual flush

Civi/Angular/Manager.php
ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php

index 7a075d585b29fa45cc272e9c0cffea97f3a0320f..dacd8f3062a372b011709d676741e3c4110024c5 100644 (file)
@@ -70,6 +70,8 @@ class Manager {
     $this->cache->clear();
     $this->modules = NULL;
     $this->changeSets = NULL;
+    // Force-refresh assetBuilder files
+    \Civi::container()->get('asset_builder')->clear(FALSE);
     return $this;
   }
 
index 18f9ced57fa305ce0b9dce74db7e9d3a294f3ec9..bee09ea6261107bb4b1a1428fcd0cbc30159c9f8 100644 (file)
@@ -79,7 +79,6 @@ trait AfformSaveTrait {
       \CRM_Core_Menu::store();
       \CRM_Core_BAO_Navigation::resetNavigation();
     }
-    // FIXME if asset-caching is enabled, then flush the asset cache.
 
     $item['module_name'] = _afform_angular_module_name($item['name'], 'camel');
     $item['directive_name'] = _afform_angular_module_name($item['name'], 'dash');