From da08a5828ab855365a2a2a6f4854b09eb409907a Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Mon, 11 May 2026 01:30:19 +0200 Subject: [PATCH] fix(customer): unwrap /customer/* from RequireFeature gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RequireFeature calls useFeatureFlags(), which throws unless mounted inside FeatureFlagsProvider — and that provider only wraps AdminLayout. So unauthenticated visitors hitting /customer/login crashed into the React error boundary with 'Oops! Something went wrong'. The customerPortal flag continues to hide every admin-side surface (sidebar entry, /admin/customers routes, CustomerAccountPicker on event forms), which is what the flag is actually for. The customer-side tree stays reachable so existing customers can still log in even if the admin flips the flag off temporarily. Co-Authored-By: Claude Opus 4.6 --- frontend/src/App.tsx | 61 ++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index fe2b0247..da045454 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -175,36 +175,41 @@ function App() { } /> {/* Customer surface (#354). Strictly separate provider / - cookie / API surface from /admin/*. Gated by the - customerPortal feature flag — when off, all - /customer/* URLs redirect to /admin/dashboard. */} - }> - - - {/* Public surfaces: login, accept-invite, reset — - no CustomerLayout (their own branded shells). */} - } /> - } /> - } /> + cookie / API surface from /admin/*. The customerPortal + feature flag hides the *admin-side* surfaces (sidebar + entry, /admin/customers routes, CustomerAccountPicker) + via RequireFeature. The customer-side /customer/* + tree stays publicly reachable so existing customers + can still log in even if the admin temporarily flips + the flag off — and because RequireFeature reads from + FeatureFlagsProvider (admin-only context), gating + these routes here would crash unauthenticated + visitors with an unmounted-provider error. */} + + + {/* Public surfaces: login, accept-invite, reset — + no CustomerLayout (their own branded shells). */} + } /> + } /> + } /> - {/* Authenticated surfaces share the sidebar layout - (Outlet pattern, mirrors AdminLayout). The - CustomerLayout itself enforces auth — bouncing - unauthenticated visitors to /customer/login. */} - }> - } /> - } /> - } /> - } /> - } /> - + {/* Authenticated surfaces share the sidebar layout + (Outlet pattern, mirrors AdminLayout). The + CustomerLayout itself enforces auth — bouncing + unauthenticated visitors to /customer/login. */} + }> + } /> + } /> + } /> + } /> + } /> + - } /> - - - } /> - + } /> + + + } /> {/* Public legal pages */} } />