diff --git a/apps/web/src/features/profile/components/FollowButton.tsx b/apps/web/src/features/profile/components/FollowButton.tsx index 9cf4588bc..840e6747f 100644 --- a/apps/web/src/features/profile/components/FollowButton.tsx +++ b/apps/web/src/features/profile/components/FollowButton.tsx @@ -16,7 +16,7 @@ interface FollowButtonProps { initialFollowerCount?: number; onFollowChange?: (isFollowing: boolean) => void; className?: string; - size?: 'sm' | 'md' | 'lg'; + size?: 'default' | 'sm' | 'lg' | 'icon'; variant?: 'default' | 'outline' | 'ghost'; } @@ -26,14 +26,13 @@ export function FollowButton({ initialFollowerCount = 0, onFollowChange, className, - size = 'md', + size = 'default', variant, }: FollowButtonProps) { const { user } = useAuthStore(); const { success: showSuccess, error: showError } = useToast(); const queryClient = useQueryClient(); const [following, setFollowing] = useState(initialFollowing); - const [followerCount, setFollowerCount] = useState(initialFollowerCount); const [isUpdating, setIsUpdating] = useState(false); // Fetch profile to get current follow status @@ -53,15 +52,6 @@ export function FollowButton({ } }, [profile, initialFollowing]); - // Update follower count from profile - useEffect(() => { - if (profile?.followers_count !== undefined) { - setFollowerCount(profile.followers_count); - } else if (initialFollowerCount !== undefined) { - setFollowerCount(initialFollowerCount); - } - }, [profile?.followers_count, initialFollowerCount]); - // Don't show follow button if viewing own profile if (user?.id === userId) { return null; @@ -82,7 +72,6 @@ export function FollowButton({ showSuccess('Vous ne suivez plus cet utilisateur'); } setFollowing(newFollowing); - setFollowerCount((prev) => (newFollowing ? prev + 1 : prev - 1)); onFollowChange?.(newFollowing); // Invalidate profile queries to refresh data queryClient.invalidateQueries({ queryKey: ['userProfile', userId] });