diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f02a2a..2e67a80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Sprig Core +## 3.3.2 - 2024-08-12 + +### Fixed + +- Fixed a bug in which asset bundles were being registered and rendered in control panel Sprig requests ([#383](https://github.com/putyourlightson/craft-sprig/issues/383)). + ## 3.3.1 - 2024-08-08 ### Fixed diff --git a/composer.json b/composer.json index 4b44487..624f43b 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-sprig-core", "description": "A reactive Twig component framework for Craft.", - "version": "3.3.1", + "version": "3.3.2", "type": "craft-module", "license": "mit", "require": { diff --git a/src/controllers/ComponentsController.php b/src/controllers/ComponentsController.php index d442cb5..40a02e9 100644 --- a/src/controllers/ComponentsController.php +++ b/src/controllers/ComponentsController.php @@ -75,7 +75,9 @@ public function actionRender(): Response // Remove flashes after rendering, so they don’t appear on subsequent requests. Craft::$app->getSession()->removeAllFlashes(); - // Append queued HTML to the content. + // Append queued HTML to the content, disregarding any asset bundles. + // https://github.com/putyourlightson/craft-sprig/issues/383 + Craft::$app->getView()->assetBundles = []; $content .= Craft::$app->getView()->getBodyHtml(); $response = Craft::$app->getResponse(); diff --git a/src/variables/SprigVariable.php b/src/variables/SprigVariable.php index af37ddd..4bbaf53 100644 --- a/src/variables/SprigVariable.php +++ b/src/variables/SprigVariable.php @@ -294,7 +294,7 @@ public function triggerRefreshOnLoad(string $selector = ''): void } /** - * Registers JavaScript code to be executed. This method takes care of registering the code depending on whether it is part of an include or a request. + * Registers JavaScript code to be executed. This method takes care of registering the code in the appropriate way depending on whether it is part of an include or a request. * * @since 2.10.0 */