From cdf6e056298a1229197b13edbaa2ad92810fe9c1 Mon Sep 17 00:00:00 2001 From: Ben Croker Date: Thu, 29 Aug 2024 09:36:29 +0200 Subject: [PATCH] Fix JS position in `sprig.triggerRefreshOnLoad` --- CHANGELOG.md | 6 +++++- src/base/Component.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28ebc33..81acd37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Release Notes for Sprig Core -## 3.5.0 - Unreleased +## 3.5.0 - 2024-08-29 ### Added @@ -10,6 +10,10 @@ - Updated htmx to version 2.0.2 ([changelog](https://github.com/bigskysoftware/htmx/blob/master/CHANGELOG.md#202---2024-08-12)). +### Fixed + +- Fixed the positioning of the JavaScript output by the `sprig.triggerRefreshOnLoad` function. + ### Deprecated - Deprecated `sprig.getIsBoosted`, `sprig.getIsError`, `sprig.getIsHistoryRestoreRequest`, `sprig.getIsInclude`, `sprig.getIsRequest`, `sprig.getIsSuccess`. Use `sprig.isBoosted`, `sprig.isError`, `sprig.isHistoryRestoreRequest`, `sprig.isInclude`, `sprig.isRequest`, `sprig.isSuccess` instead. diff --git a/src/base/Component.php b/src/base/Component.php index b09f933..83720f2 100644 --- a/src/base/Component.php +++ b/src/base/Component.php @@ -318,7 +318,7 @@ public static function triggerRefreshOnLoad(string $selector = ''): void }); JS; - Craft::$app->getView()->registerJs($js); + Craft::$app->getView()->registerJs($js, View::POS_END); } /**