@@ -211,11 +211,6 @@ private function resolveAppNavigationEntries(): void {
211211 $ this ->add ($ c ());
212212 }
213213
214- // Resolve dynamically added navigation entries via event listeners
215- if ($ this ->loadedAppInfo === []) {
216- $ this ->eventDispatcher ->dispatchTyped (new LoadAdditionalEntriesEvent ());
217- }
218-
219214 // Resolve classic info.xml based navigation entries
220215 if ($ this ->userSession ->isLoggedIn ()) {
221216 $ user = $ this ->userSession ->getUser ();
@@ -224,11 +219,12 @@ private function resolveAppNavigationEntries(): void {
224219 $ apps = $ this ->appManager ->getEnabledApps ();
225220 }
226221
222+ if (count ($ apps ) === count ($ this ->loadedAppInfo )) {
223+ // All apps that are loaded for the user have already been resolved
224+ return ;
225+ }
226+
227227 foreach ($ apps as $ app ) {
228- if ($ this ->appManager ->isAppLoaded ($ app )) {
229- // the app is not yet booted thus its routes do not yet exist
230- continue ;
231- }
232228 if (in_array ($ app , $ this ->loadedAppInfo )) {
233229 // the apps navigations were already resolved
234230 continue ;
@@ -237,8 +233,16 @@ private function resolveAppNavigationEntries(): void {
237233 // load plugins and collections from info.xml
238234 $ info = $ this ->appManager ->getAppInfo ($ app );
239235 if (!isset ($ info ['navigations ' ]['navigation ' ])) {
236+ // this app does not have any navigation entries, skip it
237+ $ this ->loadedAppInfo [] = $ app ;
238+ continue ;
239+ }
240+
241+ if (!$ this ->appManager ->isAppLoaded ($ app )) {
242+ // the app is not yet booted thus its routes do not yet exist
240243 continue ;
241244 }
245+
242246 foreach ($ info ['navigations ' ]['navigation ' ] as $ key => $ nav ) {
243247 $ nav ['type ' ] = $ nav ['type ' ] ?? 'link ' ;
244248 if (!isset ($ nav ['name ' ])) {
@@ -298,6 +302,9 @@ private function resolveAppNavigationEntries(): void {
298302 ));
299303 }
300304 }
305+
306+ // Resolve dynamically added navigation entries via event listeners
307+ $ this ->eventDispatcher ->dispatchTyped (new LoadAdditionalEntriesEvent ());
301308 }
302309
303310 private function isAdmin (): bool {
0 commit comments