diff --git a/app/modules/core/static/store/js/init-alpine.js b/app/modules/core/static/store/js/init-alpine.js index 5de4df15..83ad6c97 100644 --- a/app/modules/core/static/store/js/init-alpine.js +++ b/app/modules/core/static/store/js/init-alpine.js @@ -65,14 +65,16 @@ function data() { openSections: getStoreSidebarSectionsFromStorage(), init() { - // Set current page from URL - const path = window.location.pathname; - const segments = path.split('/').filter(Boolean); - // For /store/ABC/orders/123 -> 'orders' (skip numeric IDs) - const last = segments[segments.length - 1] || 'dashboard'; - this.currentPage = /^\d+$/.test(last) && segments.length > 2 - ? segments[segments.length - 2] - : last; + // Set current page from URL (only if not already set by child component) + if (!this.currentPage) { + const path = window.location.pathname; + const segments = path.split('/').filter(Boolean); + // For /store/ABC/orders/123 -> 'orders' (skip numeric IDs) + const last = segments[segments.length - 1] || 'dashboard'; + this.currentPage = /^\d+$/.test(last) && segments.length > 2 + ? segments[segments.length - 2] + : last; + } // Get store code from server-rendered value or URL fallback this.storeCode = window.STORE_CODE || null;