From eec76c50d5e78f897fb8dc8b64e6b25b0e61742f Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Wed, 1 Oct 2025 00:01:37 +0000 Subject: [PATCH] Fallback listProfiles when table missing cgen-f0da836d6f87442da49bcb67d2bb86f4 --- client/lib/aethex-database-adapter.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/client/lib/aethex-database-adapter.ts b/client/lib/aethex-database-adapter.ts index 651a67f3..eefb3ede 100644 --- a/client/lib/aethex-database-adapter.ts +++ b/client/lib/aethex-database-adapter.ts @@ -213,9 +213,22 @@ export const aethexUserService = { if (error) { if (isTableMissing(error)) { - throw new Error( - 'Supabase table "user_profiles" is missing. Please run the required migrations.', - ); + console.warn('user_profiles table missing during listProfiles - returning local demo profiles'); + try { + const keys = Object.keys(localStorage || {}).filter((k) => k.startsWith('demo_profile_')); + const profiles = keys + .map((k) => { + try { + return JSON.parse(localStorage.getItem(k) || "null"); + } catch { + return null; + } + }) + .filter(Boolean) as AethexUserProfile[]; + return profiles.slice(0, limit); + } catch { + return []; + } } throw error; }