From 39579b65e93dd7457c2b4f0ee9242576e5e35512 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 20 Nov 2025 16:09:08 +0100 Subject: [PATCH] perf: Prepend the app as a whole Signed-off-by: Joas Schilling --- lib/public/Util.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/public/Util.php b/lib/public/Util.php index 70a862880f19d..b417238767005 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -168,6 +168,15 @@ public static function addScript(string $application, ?string $file = null, stri } if ($prepend) { + // Make sure the scripts of prepended applications are prepended within + // the apps as well, so that e.g. Talk can prepend itself on `/call/123456` + // URLs within it's template file, instead of being at the end, because + // other apps already queued after `core` using an earlier event or the + // `Application::boot()` method. + $appDeps = self::$scriptDeps[$application] ?? []; + unset(self::$scriptDeps[$application]); + self::$scriptDeps = [$application => $appDeps] + self::$scriptDeps; + array_unshift(self::$scripts[$application], $path); } else { self::$scripts[$application][] = $path;