Guard supabase.channel in aethexRealtimeService

cgen-77ab1761744c406d80570099654cb9df
This commit is contained in:
Builder.io 2025-09-28 00:23:02 +00:00
parent abaee59965
commit d7f628015d

View file

@ -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",