mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 02:31:12 -05:00
Apply all API enhancements
This commit is contained in:
@@ -34,6 +34,7 @@ import { useDocumentTitle } from '@/hooks/useDocumentTitle';
|
||||
import { useOpenGraph } from '@/hooks/useOpenGraph';
|
||||
import { useProfileActivity } from '@/hooks/profile/useProfileActivity';
|
||||
import { useProfileStats } from '@/hooks/profile/useProfileStats';
|
||||
import { useQueryInvalidation } from '@/lib/queryInvalidation';
|
||||
|
||||
// Activity type definitions
|
||||
interface SubmissionActivity {
|
||||
@@ -150,6 +151,9 @@ export default function Profile() {
|
||||
const [avatarUrl, setAvatarUrl] = useState<string>('');
|
||||
const [avatarImageId, setAvatarImageId] = useState<string>('');
|
||||
|
||||
// Query invalidation for cache updates
|
||||
const { invalidateProfileActivity, invalidateProfileStats } = useQueryInvalidation();
|
||||
|
||||
// User role checking
|
||||
const { isModerator, loading: rolesLoading } = useUserRole();
|
||||
|
||||
@@ -325,6 +329,13 @@ export default function Profile() {
|
||||
error
|
||||
} = await supabase.from('profiles').update(updateData).eq('user_id', currentUser.id);
|
||||
if (error) throw error;
|
||||
|
||||
// Invalidate profile caches across the app
|
||||
if (currentUser.id) {
|
||||
invalidateProfileActivity(currentUser.id);
|
||||
invalidateProfileStats(currentUser.id);
|
||||
}
|
||||
|
||||
setProfile(prev => prev ? {
|
||||
...prev,
|
||||
...updateData
|
||||
@@ -374,6 +385,11 @@ export default function Profile() {
|
||||
}).eq('user_id', currentUser.id);
|
||||
if (error) throw error;
|
||||
|
||||
// Invalidate profile activity cache (avatar shows in activity)
|
||||
if (currentUser.id) {
|
||||
invalidateProfileActivity(currentUser.id);
|
||||
}
|
||||
|
||||
// Update local profile state
|
||||
setProfile(prev => prev ? {
|
||||
...prev,
|
||||
|
||||
Reference in New Issue
Block a user