Make mock query builder thenable so await returns {data,error}

cgen-40d5853fd30140b8a14188a749884247
This commit is contained in:
Builder.io 2025-09-27 20:57:01 +00:00
parent b1021f0b1b
commit 793b437730

View file

@ -145,7 +145,9 @@ export const supabase = new Proxy(supabaseClient || {}, {
order: () => builder,
limit: () => builder,
single: async () => ({ data: rows[0] ?? {}, error: null }),
then: undefined, // prevent accidental Promise behavior
then: (resolve: any) => resolve({ data: rows, error: null }),
catch: () => builder,
finally: (cb: any) => { cb?.(); return builder; },
};
return builder;
};