From 3c6ce0cbdb22154c419349a936ef1d9487ce4a34 Mon Sep 17 00:00:00 2001 From: fs Date: Wed, 22 Apr 2026 20:39:20 +0200 Subject: [PATCH] fix(topbar): resolve theme + tenant-switch endpoints via lurl() to avoid relative URL breakage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both endpoints were declared as bare relative paths ("admin/users/theme", "admin/users/switch-tenant") and handed to postForm(), which normalizes through `new URL(value, window.location.href)`. On a deep route like /de/admin/permissions that resolves to /de/admin/admin/users/theme — 404 → 302 to error page → HTML response → JSON.parse throws → the theme toggle reverts visually. The tenant switcher had the same latent bug. - Topbar renders data-theme-url and data-switch-tenant-url via lurl(), so both carry the locale-aware root-anchored path. - Tenant switcher reads data-switch-tenant-url from the switcher root (matching the theme-menu convention) and passes it through to switchTenant(); fail-fast warning if the attribute is missing. Co-Authored-By: Claude Opus 4.7 (1M context) --- templates/partials/app-topbar.phtml | 4 ++-- web/js/components/app-tenant-switcher.js | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/templates/partials/app-topbar.phtml b/templates/partials/app-topbar.phtml index ce2fa3d..ffc6c64 100644 --- a/templates/partials/app-topbar.phtml +++ b/templates/partials/app-topbar.phtml @@ -85,7 +85,7 @@ $moduleTopbarSlots = is_array($moduleSlots['topbar.right_item'] ?? null) ? $modu ?> -
  • +