From d7f628015d2d49e9884cd97dfbb0e7af6c40775b Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 28 Sep 2025 00:23:02 +0000 Subject: [PATCH] Guard supabase.channel in aethexRealtimeService cgen-77ab1761744c406d80570099654cb9df --- client/lib/aethex-database-adapter.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/lib/aethex-database-adapter.ts b/client/lib/aethex-database-adapter.ts index b720c63e..8ad26b0b 100644 --- a/client/lib/aethex-database-adapter.ts +++ b/client/lib/aethex-database-adapter.ts @@ -567,13 +567,17 @@ export const aethexRealtimeService = { userId: string, callback: (notification: any) => void, ) { - return supabase + const client: any = supabase as any; + if (!client || typeof client.channel !== "function") { + return { unsubscribe: () => {} } as any; + } + return client .channel(`notifications:${userId}`) .on( "postgres_changes", { event: "INSERT", - schema: "public", + schema: "public", table: "notifications", filter: `user_id=eq.${userId}`, }, @@ -583,7 +587,11 @@ export const aethexRealtimeService = { }, subscribeToProjects(callback: (project: any) => void) { - return supabase + const client: any = supabase as any; + if (!client || typeof client.channel !== "function") { + return { unsubscribe: () => {} } as any; + } + return client .channel("projects") .on( "postgres_changes",