Skip to content

Commit ca5e283

Browse files
committed
don't always add core/common and core/main during "sorting"
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 40cf409 commit ca5e283

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

core/Listener/BeforeTemplateRenderedListener.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public function handle(Event $event): void {
4949

5050
\OC_Util::addStyle('server', null, true);
5151

52+
if ($event instanceof BeforeLoginTemplateRenderedEvent) {
53+
// todo: make login work without these
54+
Util::addScript('core', 'common');
55+
Util::addScript('core', 'main');
56+
}
57+
5258
if ($event instanceof BeforeTemplateRenderedEvent) {
5359
// include common nextcloud webpack bundle
5460
Util::addScript('core', 'common');

lib/public/Util.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ public static function getScripts(): array {
212212
$sortedScripts = $sortedScripts ? array_merge(...array_values(($sortedScripts))) : [];
213213

214214
// Override core-common and core-main order
215-
array_unshift($sortedScripts, 'core/js/common', 'core/js/main');
215+
if (in_array('core/js/main', $sortedScripts)) {
216+
array_unshift($sortedScripts, 'core/js/main');
217+
}
218+
if (in_array('core/js/common', $sortedScripts)) {
219+
array_unshift($sortedScripts, 'core/js/common');
220+
}
216221

217222
return array_unique($sortedScripts);
218223
}

0 commit comments

Comments
 (0)