From 9f8a4dfd98f853ad005208b939b36c953813743f Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Wed, 5 Nov 2025 07:21:23 +0000 Subject: [PATCH] completionId: cgen-a688056a498840bdb1931a7a8c445a1b cgen-a688056a498840bdb1931a7a8c445a1b --- client/lib/aethex-social-service.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/client/lib/aethex-social-service.ts b/client/lib/aethex-social-service.ts index a2af8b4a..bc9d11b5 100644 --- a/client/lib/aethex-social-service.ts +++ b/client/lib/aethex-social-service.ts @@ -29,10 +29,21 @@ export const aethexSocialService = { async getFollowing(userId: string): Promise { try { - const { data, error } = await supabase - .from("user_follows") - .select("following_id") - .eq("follower_id", userId); + // Add timeout to prevent hanging + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), 8000); + + const { data, error } = await Promise.race([ + supabase + .from("user_follows") + .select("following_id") + .eq("follower_id", userId), + new Promise((_, reject) => + setTimeout(() => reject(new Error("getFollowing timeout")), 7900), + ), + ]); + + clearTimeout(timeoutId); if (error) { console.error(