diff --git a/containers/libreportal/frontend/components/apps/core/js/apps-manager.js b/containers/libreportal/frontend/components/apps/core/js/apps-manager.js index 55fe288..41727e4 100755 --- a/containers/libreportal/frontend/components/apps/core/js/apps-manager.js +++ b/containers/libreportal/frontend/components/apps/core/js/apps-manager.js @@ -373,8 +373,20 @@ class AppsManager { const currentUrl = new URL(window.location.href); targetTab = currentUrl.searchParams.get('tab') || 'config'; } - - const newUrl = window.appPath(appName, targetTab); + + // Preserve the config sub-category (/app//config/) when the URL + // already points at THIS app's config. Without this, rebuilding the URL + // here strips the sub before renderAppDetail reads it back off the path, so + // a cold-load deep-link / refresh of e.g. /app/bookstack/config/ports always + // reset to the first category. Only kept for the same app — a cross-app + // switch intentionally starts at the first category. + let targetSub = null; + if (targetTab === 'config' && window.appPartsFromPath) { + const parts = window.appPartsFromPath(window.location.pathname); + if (parts.tab === 'config' && parts.app === appName) targetSub = parts.sub; + } + + const newUrl = window.appPath(appName, targetTab, targetSub); history.pushState({}, '', newUrl); // Update app-tabbed-manager BEFORE rendering the DOM. If renderAppDetail or