Uitloggen met uitgeschakeld CMS hing de app: de AppLayout-redirect naar /dashboard gold ook voor een gast (eindeloze navigatielus); alleen voor een ingelogde gebruiker

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 23:46:24 +01:00
co-authored by Claude Sonnet 5.5
parent 893c40c46d
commit cc8561e1f4
2 changed files with 62 additions and 1 deletions
+5 -1
View File
@@ -22,11 +22,15 @@ export function AppLayout() {
}, [status, navigate]);
useEffect(() => {
// Only for a signed-in user. A guest (just signed out) must be left alone: sending a guest to /dashboard
// makes the authenticated route redirect straight back to /login, and with the CMS switched off this
// effect then fires again - an endless navigation loop that froze the app after logout.
if (status !== 'authenticated') return;
if (availability?.status === 'NotAvailable') {
const allowed = ALLOWED_WHEN_UNAVAILABLE.some(p => location.pathname.startsWith(p));
if (!allowed) void navigate({ to: '/dashboard' });
}
}, [availability?.status, location.pathname, navigate]);
}, [status, availability?.status, location.pathname, navigate]);
if (!isAuthenticated) {
return null;