Add safe channel fallback in supabase proxy

cgen-e200d5d6f64b4dc0b04825c5369711a9
This commit is contained in:
Builder.io 2025-09-28 00:26:42 +00:00
parent e60ed816d4
commit e12a453f61

View file

@ -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);