From c685c27b154742cc4d91f23039c67d39fb692b12 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Fri, 26 Dec 2025 22:58:21 +0700 Subject: [PATCH] fix: Add exact flags to All orders/products/customers submenus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submenu Active State Fix (Backend): Problem: All orders/products/customers always showed active on detail pages Root Cause: Backend navigation tree missing 'exact' flag for these items - All orders at /orders matched /orders/123 (detail page) - All products at /products matched /products/456 (detail page) - All customers at /customers matched /customers/789 (detail page) Solution: Added 'exact' => true flag to backend navigation tree - Orders > All orders: path '/orders' with exact flag - Products > All products: path '/products' with exact flag - Customers > All customers: path '/customers' with exact flag Frontend already handles exact flag correctly (previous commit) Result: Submenu items now only active on index pages, not detail pages ✅ Files Modified: - includes/Compat/NavigationRegistry.php (added exact flags) - admin-spa/dist/app.js (rebuilt) All submenu active state issues now resolved! --- includes/Compat/NavigationRegistry.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/Compat/NavigationRegistry.php b/includes/Compat/NavigationRegistry.php index 9525eda..0e60760 100644 --- a/includes/Compat/NavigationRegistry.php +++ b/includes/Compat/NavigationRegistry.php @@ -127,7 +127,7 @@ class NavigationRegistry { 'path' => '/orders', 'icon' => 'receipt-text', 'children' => [ - ['label' => __('All orders', 'woonoow'), 'mode' => 'spa', 'path' => '/orders'], + ['label' => __('All orders', 'woonoow'), 'mode' => 'spa', 'path' => '/orders', 'exact' => true], ['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/orders/new'], // Future: Drafts, Recurring, etc. ], @@ -138,7 +138,7 @@ class NavigationRegistry { 'path' => '/products', 'icon' => 'package', 'children' => [ - ['label' => __('All products', 'woonoow'), 'mode' => 'spa', 'path' => '/products'], + ['label' => __('All products', 'woonoow'), 'mode' => 'spa', 'path' => '/products', 'exact' => true], ['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/products/new'], ['label' => __('Categories', 'woonoow'), 'mode' => 'spa', 'path' => '/products/categories'], ['label' => __('Tags', 'woonoow'), 'mode' => 'spa', 'path' => '/products/tags'], @@ -151,7 +151,7 @@ class NavigationRegistry { 'path' => '/customers', 'icon' => 'users', 'children' => [ - ['label' => __('All customers', 'woonoow'), 'mode' => 'spa', 'path' => '/customers'], + ['label' => __('All customers', 'woonoow'), 'mode' => 'spa', 'path' => '/customers', 'exact' => true], ['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/customers/new'], ], ],