Reverted to commit 0091584677

This commit is contained in:
gpt-engineer-app[bot]
2025-11-01 15:22:30 +00:00
parent 26e5753807
commit 133141d474
125 changed files with 2316 additions and 9102 deletions

View File

@@ -1,8 +1,6 @@
import { useState, useCallback } from 'react';
import { supabase } from '@/integrations/supabase/client';
import { handleError, handleSuccess } from '@/lib/errorHandler';
import { useQueryInvalidation } from '@/lib/queryInvalidation';
import { useAuth } from '@/hooks/useAuth';
export type AvatarUploadState = {
url: string;
@@ -15,8 +13,6 @@ export const useAvatarUpload = (
initialImageId: string = '',
username: string
) => {
const { user } = useAuth();
const { invalidateUserProfile } = useQueryInvalidation();
const [state, setState] = useState<AvatarUploadState>({
url: initialUrl,
imageId: initialImageId,
@@ -52,11 +48,6 @@ export const useAvatarUpload = (
setState(prev => ({ ...prev, isUploading: false }));
handleSuccess('Avatar updated', 'Your avatar has been successfully updated.');
// Invalidate user profile cache for instant UI update
if (user?.id) {
invalidateUserProfile(user.id);
}
return { success: true };
} catch (error: unknown) {
// Rollback on error
@@ -73,7 +64,7 @@ export const useAvatarUpload = (
return { success: false, error };
}
}, [username, initialUrl, initialImageId, user?.id, invalidateUserProfile]);
}, [username, initialUrl, initialImageId]);
const resetAvatar = useCallback(() => {
setState({