From e12a453f611fdd25fb796c20ed9bc5f2afadd4a6 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 28 Sep 2025 00:26:42 +0000 Subject: [PATCH] Add safe channel fallback in supabase proxy cgen-e200d5d6f64b4dc0b04825c5369711a9 --- client/lib/supabase.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/lib/supabase.ts b/client/lib/supabase.ts index 6589c6fe..01d2d9f7 100644 --- a/client/lib/supabase.ts +++ b/client/lib/supabase.ts @@ -144,6 +144,20 @@ export const supabase = new Proxy(supabaseClient || {}, { }; } + if (prop === "channel") { + if (isSupabaseConfigured && target && typeof target.channel === "function") { + return target.channel.bind(target); + } + return function () { + const ch: any = { + on: () => ch, + subscribe: () => ({ unsubscribe: () => {} }), + unsubscribe: () => {}, + }; + return ch; + }; + } + if (prop === "from") { if (isSupabaseConfigured && target && typeof target.from === "function") { return target.from.bind(target);