diff --git a/frontend/src/components/OnboardingWizard/BusinessDescriptionStep.tsx b/frontend/src/components/OnboardingWizard/BusinessDescriptionStep.tsx index b25bca56..ba5ec3cf 100644 --- a/frontend/src/components/OnboardingWizard/BusinessDescriptionStep.tsx +++ b/frontend/src/components/OnboardingWizard/BusinessDescriptionStep.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'; import { Box, Button, TextField, Typography, Card, CardContent, CircularProgress, Alert } from '@mui/material'; import { ArrowBack as ArrowBackIcon, Save as SaveIcon, CheckCircle as CheckCircleIcon } from '@mui/icons-material'; import { businessInfoApi, BusinessInfo } from '../../api/businessInfo'; +import { onboardingCache } from '../../services/onboardingCache'; interface BusinessDescriptionStepProps { onBack: () => void; @@ -19,6 +20,17 @@ const BusinessDescriptionStep: React.FC = ({ onBac const [error, setError] = useState(null); const [success, setSuccess] = useState(null); + useEffect(() => { + console.log('🔄 BusinessDescriptionStep mounted. Loading cached data...'); + const cachedData = onboardingCache.getStepData(2)?.businessInfo; + if (cachedData) { + setFormData(cachedData); + console.log('✅ Loaded cached business info:', cachedData); + } else { + console.log('â„šī¸ No cached business info found.'); + } + }, []); + const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setFormData(prev => ({ ...prev, [name]: value })); @@ -39,6 +51,10 @@ const BusinessDescriptionStep: React.FC = ({ onBac console.log('✅ Business info saved to DB:', response); setSuccess('Business information saved successfully!'); + // Also save to cache for consistency with other steps + onboardingCache.saveStepData(2, { businessInfo: response, hasWebsite: false }); + console.log('✅ Business info saved to cache.'); + setTimeout(() => { onContinue(); }, 1500); // Give user time to see success message