@@ -47,7 +47,7 @@ class NavigationManager implements INavigationManager {
4747 /** @var IConfig */
4848 private $ config ;
4949 /** User defined app order (cached for the `add` function) */
50- private array $ customAppOrder ;
50+ private ? array $ customAppOrder = null ;
5151 private LoggerInterface $ logger ;
5252
5353 public function __construct (
@@ -209,6 +209,15 @@ public function getActiveEntry() {
209209 }
210210
211211 private function init (bool $ resolveClosures = true ): void {
212+ if ($ this ->customAppOrder === null ) {
213+ if ($ this ->userSession ->isLoggedIn ()) {
214+ $ user = $ this ->userSession ->getUser ();
215+ $ this ->customAppOrder = json_decode ($ this ->config ->getUserValue ($ user ->getUID (), 'core ' , 'apporder ' , '[] ' ), true , flags:JSON_THROW_ON_ERROR );
216+ } else {
217+ $ this ->customAppOrder = [];
218+ }
219+ }
220+
212221 if ($ resolveClosures ) {
213222 while ($ c = array_pop ($ this ->closureEntries )) {
214223 $ this ->add ($ c ());
@@ -329,10 +338,8 @@ private function init(bool $resolveClosures = true): void {
329338 if ($ this ->userSession ->isLoggedIn ()) {
330339 $ user = $ this ->userSession ->getUser ();
331340 $ apps = $ this ->appManager ->getEnabledAppsForUser ($ user );
332- $ this ->customAppOrder = json_decode ($ this ->config ->getUserValue ($ user ->getUID (), 'core ' , 'apporder ' , '[] ' ), true , flags:JSON_THROW_ON_ERROR );
333341 } else {
334342 $ apps = $ this ->appManager ->getEnabledApps ();
335- $ this ->customAppOrder = [];
336343 }
337344
338345 foreach ($ apps as $ app ) {
0 commit comments