fix(customer): unwrap /customer/* from RequireFeature gate

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 <[email protected]>
This commit is contained in:
Luca
2026-05-11 01:30:19 +02:00
co-authored by Claude Opus 4.6
parent f048011324
commit da08a5828a
+10 -5
View File
@@ -175,10 +175,16 @@ function App() {
<Route path="/invite/:token" element={<AcceptInvitePage />} /> <Route path="/invite/:token" element={<AcceptInvitePage />} />
{/* Customer surface (#354). Strictly separate provider / {/* Customer surface (#354). Strictly separate provider /
cookie / API surface from /admin/*. Gated by the cookie / API surface from /admin/*. The customerPortal
customerPortal feature flag — when off, all feature flag hides the *admin-side* surfaces (sidebar
/customer/* URLs redirect to /admin/dashboard. */} entry, /admin/customers routes, CustomerAccountPicker)
<Route element={<RequireFeature flag="customerPortal" fallback="/admin/login" />}> 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. */}
<Route path="/customer/*" element={ <Route path="/customer/*" element={
<CustomerAuthProvider> <CustomerAuthProvider>
<Routes> <Routes>
@@ -204,7 +210,6 @@ function App() {
</Routes> </Routes>
</CustomerAuthProvider> </CustomerAuthProvider>
} /> } />
</Route>
{/* Public legal pages */} {/* Public legal pages */}
<Route path="/impressum" element={<LegalPage />} /> <Route path="/impressum" element={<LegalPage />} />