debug: Add comprehensive logging to profile save/fetch operations

Added detailed console logging to track data flow:
- ProfileSettings: Log data being saved and save responses
- ProfileSettings: Log data being loaded when page opens
- Dashboard: Log profile data being fetched and set to state

This will help identify where profile data is being lost between
save in ProfileSettings and display in Dashboard.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-29 04:30:43 +03:00
parent 9ca14ec300
commit ca510ead86
2 changed files with 42 additions and 18 deletions
+7 -1
View File
@@ -32,6 +32,8 @@ export default function Dashboard() {
const fetchProfile = async () => {
if (!user) return;
console.log('📥 FETCHING PROFILE for user:', user.id);
try {
const { data, error } = await supabase
.from('profiles')
@@ -39,6 +41,9 @@ export default function Dashboard() {
.eq('id', user.id)
.single();
console.log('📊 FETCHED PROFILE DATA:', data);
console.log('❌ Fetch error:', error);
if (error) throw error;
// Auto-sync user metadata from Auth to profiles if missing
@@ -78,9 +83,10 @@ export default function Dashboard() {
// Note: Email verification is handled by Supabase Auth (user.email_confirmed_at)
// We don't store it in profiles table to avoid duplication
console.log('✅ SETTING PROFILE STATE TO:', data);
setProfile(data);
} catch (error) {
console.error('Error fetching profile:', error);
console.error('Error fetching profile:', error);
} finally {
setLoading(false);
}