debug(frontend): instrument ProtectedRoute gating with shouldSkipOnboarding log
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import React from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Navigate } from 'react-router-dom';
|
import { Navigate } from 'react-router-dom';
|
||||||
import { useAuth } from '@clerk/clerk-react';
|
import { useAuth } from '@clerk/clerk-react';
|
||||||
import { Box, CircularProgress, Typography, Alert, Button } from '@mui/material';
|
import { Box, CircularProgress, Typography, Alert, Button } from '@mui/material';
|
||||||
import { Refresh as RefreshIcon } from '@mui/icons-material';
|
import { Refresh as RefreshIcon } from '@mui/icons-material';
|
||||||
import { useOnboarding } from '../../contexts/OnboardingContext';
|
import { useOnboarding } from '../../contexts/OnboardingContext';
|
||||||
|
import { shouldSkipOnboarding } from '../../utils/demoMode';
|
||||||
|
|
||||||
interface ProtectedRouteProps {
|
interface ProtectedRouteProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -21,6 +22,15 @@ const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ children }) => {
|
|||||||
clearError
|
clearError
|
||||||
} = useOnboarding();
|
} = useOnboarding();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
const skip = shouldSkipOnboarding();
|
||||||
|
console.log('ProtectedRoute: gating shouldSkipOnboarding =', skip);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('ProtectedRoute: gating log error', e);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Local fallback (in case context hasn't refreshed yet right after completion)
|
// Local fallback (in case context hasn't refreshed yet right after completion)
|
||||||
const localComplete = (() => {
|
const localComplete = (() => {
|
||||||
try { return localStorage.getItem('onboarding_complete') === 'true'; } catch { return false; }
|
try { return localStorage.getItem('onboarding_complete') === 'true'; } catch { return false; }
|
||||||
|
|||||||
Reference in New Issue
Block a user