Skip to content

Commit 76379cd

Browse files
nickvergessenAndyScherzinger
authored andcommitted
fix(navigation): Fix default app entry registered as closure
Signed-off-by: Joas Schilling <[email protected]>
1 parent 331ed95 commit 76379cd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/private/NavigationManager.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function add($entry) {
7070
$this->closureEntries[] = $entry;
7171
return;
7272
}
73-
$this->init();
73+
$this->init(false);
7474

7575
$id = $entry['id'];
7676

@@ -106,10 +106,6 @@ public function add($entry) {
106106
*/
107107
public function getAll(string $type = 'link'): array {
108108
$this->init();
109-
foreach ($this->closureEntries as $c) {
110-
$this->add($c());
111-
}
112-
$this->closureEntries = [];
113109

114110
$result = $this->entries;
115111
if ($type !== 'all') {
@@ -195,7 +191,13 @@ public function getActiveEntry() {
195191
return $this->activeEntry;
196192
}
197193

198-
private function init() {
194+
private function init(bool $resolveClosures = true): void {
195+
if ($resolveClosures) {
196+
while ($c = array_pop($this->closureEntries)) {
197+
$this->add($c());
198+
}
199+
}
200+
199201
if ($this->init) {
200202
return;
201203
}

0 commit comments

Comments
 (0)