From 8dc409c8dcdf67d890ed1956bc7570def2aac881 Mon Sep 17 00:00:00 2001 From: Ben Croker Date: Tue, 20 Aug 2024 20:31:09 +0200 Subject: [PATCH] Fix console output --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- src/helpers/Console.php | 5 ++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3db1fe..9acedcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Sprig Core +## 3.4.1 - 2024-08-20 + +### Fixed + +- Fixed a bug that was breaking the `Sprig` variable in the browser console with `devMode` enabled. + ## 3.4.0 - 2024-08-20 ### Changed diff --git a/composer.json b/composer.json index a350d01..dd92ab1 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.4.0", + "version": "3.4.1", "type": "craft-module", "license": "mit", "require": { diff --git a/src/helpers/Console.php b/src/helpers/Console.php index c041af0..486e715 100644 --- a/src/helpers/Console.php +++ b/src/helpers/Console.php @@ -9,7 +9,6 @@ use craft\helpers\Json; use putyourlightson\sprig\base\Component; use putyourlightson\sprig\models\ConfigModel; -use putyourlightson\sprig\Sprig; /** * Manages the Sprig object in the console. @@ -34,7 +33,7 @@ public static function init(): void self::$initialised = true; - Sprig::$core->requests->registerJs('Sprig = {components: []}'); + Component::registerJs('Sprig = {components: []}'); } /** @@ -50,6 +49,6 @@ public static function addComponent(ConfigModel $config): void $value = Json::encode($config->getAttributes()); - Sprig::$core->requests->registerJs('Sprig.components.push(' . $value . ')'); + Component::registerJs('Sprig.components.push(' . $value . ')'); } }