Skip to content

Commit 01bb2d9

Browse files
committed
fix(AdminUrlGenerator): unitialize before early returns
1 parent f74d74f commit 01bb2d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Router/AdminUrlGenerator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
final class AdminUrlGenerator implements AdminUrlGeneratorInterface
2020
{
21-
private bool $isInitialized = false;
21+
public bool $isInitialized = false;
2222
private ?string $dashboardRoute = null;
2323
private ?bool $includeReferrer = null;
2424
/** @var array<string, mixed> */
@@ -288,11 +288,14 @@ public function generateUrl(): string
288288
// if no route parameters are passed, the route doesn't point to any CRUD controller
289289
// action or to any custom action/route; consider it a link to the current dashboard
290290
if ([] === $routeParameters) {
291+
$this->isInitialized = false;
292+
291293
return $this->urlGenerator->generate($this->dashboardRoute, [], $urlType);
292294
}
293295

294296
if (null !== $routeName = $this->get(EA::ROUTE_NAME)) {
295297
$adminRoutes = $this->cache->getItem(AdminRouteGenerator::CACHE_KEY_ROUTE_TO_FQCN)->get();
298+
$this->isInitialized = false;
296299
if (null !== $adminRoutes && \array_key_exists($routeName, $adminRoutes)) {
297300
return $this->urlGenerator->generate($routeName, $routeParameters[EA::ROUTE_PARAMS] ?? [], $urlType);
298301
}

0 commit comments

Comments
 (0)