Compare commits

..

1 Commits

Author SHA1 Message Date
ي
a0efdb5001 Fix onboarding loading gate for inactive subscriptions 2026-03-31 07:33:17 +05:30
2 changed files with 8 additions and 23 deletions

View File

@@ -48,13 +48,6 @@ load_dotenv(backend_dir / '.env') # backend/.env
load_dotenv(project_root / '.env') # root .env (fallback)
load_dotenv() # CWD .env (fallback)
PODCAST_ONLY_DEMO_MODE = os.getenv("PODCAST_ONLY_DEMO_MODE", "false").lower() in {
"1",
"true",
"yes",
"on",
}
# Set up clean logging for end users
from logging_config import setup_clean_logging
setup_clean_logging()
@@ -190,9 +183,7 @@ rate_limiter = RateLimiter(window_seconds=60, max_requests=200)
frontend_serving = FrontendServing(app)
router_manager = RouterManager(app)
onboarding_manager = None
if not PODCAST_ONLY_DEMO_MODE:
onboarding_manager = OnboardingManager(app)
onboarding_manager = OnboardingManager(app)
# Middleware Order (FastAPI executes in REVERSE order of registration - LIFO):
# Registration order: 1. Monitoring 2. Rate Limit 3. API Key Injection
@@ -264,14 +255,7 @@ async def router_status():
# Onboarding management endpoints
@app.get("/api/onboarding/status")
async def onboarding_status():
"""Get onboarding manager status (or demo-mode disabled state)."""
if PODCAST_ONLY_DEMO_MODE:
return {
"enabled": False,
"status": "disabled",
"message": "Onboarding is disabled for podcast-only demo mode.",
"demo_mode": "podcast_only",
}
"""Get onboarding manager status."""
return onboarding_manager.get_onboarding_status()
# Include routers using modular utilities

View File

@@ -280,10 +280,11 @@ const InitialRouteHandler: React.FC = () => {
);
}
// Loading state - only wait for onboarding init, not subscription check
// Subscription check is non-blocking and happens in background
const waitingForOnboardingInit = loading || !data;
if (loading || waitingForOnboardingInit) {
// Only block on onboarding initialization once we know the user has an active subscription.
// This allows no-subscription/inactive flows to continue even when onboarding data is still null.
const isActiveSubscriber = Boolean(subscription && subscription.active && subscription.plan !== 'none');
const waitingForOnboardingInit = isActiveSubscriber && (loading || !data);
if (waitingForOnboardingInit) {
return (
<Box
display="flex"
@@ -295,7 +296,7 @@ const InitialRouteHandler: React.FC = () => {
>
<CircularProgress size={60} />
<Typography variant="h6" color="textSecondary">
{subscriptionLoading ? 'Checking subscription...' : 'Preparing your workspace...'}
Preparing your workspace...
</Typography>
</Box>
);