Add safe channel fallback in supabase proxy
cgen-e200d5d6f64b4dc0b04825c5369711a9
This commit is contained in:
parent
e60ed816d4
commit
e12a453f61
1 changed files with 14 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue