diff --git a/app/components/chat/SupabaseConnection.tsx b/app/components/chat/SupabaseConnection.tsx index 7844fab..a9261f4 100644 --- a/app/components/chat/SupabaseConnection.tsx +++ b/app/components/chat/SupabaseConnection.tsx @@ -70,10 +70,10 @@ export function SupabaseConnection() { }, [isConnected, supabaseConn.token]); useEffect(() => { - if (isConnected && supabaseConn.selectedProjectId && supabaseConn.token) { + if (isConnected && supabaseConn.selectedProjectId && supabaseConn.token && !supabaseConn.credentials) { fetchProjectApiKeys(supabaseConn.selectedProjectId).catch(console.error); } - }, [isConnected, supabaseConn.selectedProjectId, supabaseConn.token]); + }, [isConnected, supabaseConn.selectedProjectId, supabaseConn.token, supabaseConn.credentials]); return (
diff --git a/app/lib/common/prompts/prompts.ts b/app/lib/common/prompts/prompts.ts index eb7ec1a..7d24547 100644 --- a/app/lib/common/prompts/prompts.ts +++ b/app/lib/common/prompts/prompts.ts @@ -80,17 +80,14 @@ You are Bolt, an expert AI assistant and exceptional senior software developer w : '' : '' } - IMPORTANT: Create a .env file if it doesnt exist and include the following variables: - ${ - supabase?.isConnected && - supabase?.hasSelectedProject && - supabase?.credentials?.supabaseUrl && - supabase?.credentials?.anonKey - ? `VITE_SUPABASE_URL=${supabase.credentials.supabaseUrl} - VITE_SUPABASE_ANON_KEY=${supabase.credentials.anonKey}` - : 'SUPABASE_URL=your_supabase_url\nSUPABASE_ANON_KEY=your_supabase_anon_key' - } - NEVER modify any Supabase configuration or \`.env\` files. + IMPORTANT: Create a .env file and ALWAYS populate the variables${ + supabase?.credentials?.supabaseUrl && supabase?.credentials?.anonKey + ? ` and include the following variables: + VITE_SUPABASE_URL=${supabase.credentials.supabaseUrl} + VITE_SUPABASE_ANON_KEY=${supabase.credentials.anonKey}` + : '.' + } + NEVER modify any Supabase configuration or \`.env\` files apart from creating the \`.env\`. CRITICAL DATA PRESERVATION AND SAFETY REQUIREMENTS: - DATA INTEGRITY IS THE HIGHEST PRIORITY, users must NEVER lose their data diff --git a/app/lib/stores/supabase.ts b/app/lib/stores/supabase.ts index 3b8a581..7254091 100644 --- a/app/lib/stores/supabase.ts +++ b/app/lib/stores/supabase.ts @@ -27,6 +27,7 @@ export interface SupabaseConnectionState { } const savedConnection = typeof localStorage !== 'undefined' ? localStorage.getItem('supabase_connection') : null; +const savedCredentials = typeof localStorage !== 'undefined' ? localStorage.getItem('supabaseCredentials') : null; const initialState: SupabaseConnectionState = savedConnection ? JSON.parse(savedConnection) @@ -39,6 +40,14 @@ const initialState: SupabaseConnectionState = savedConnection project: undefined, }; +if (savedCredentials && !initialState.credentials) { + try { + initialState.credentials = JSON.parse(savedCredentials); + } catch (e) { + console.error('Failed to parse saved credentials:', e); + } +} + export const supabaseConnection = atom(initialState); if (initialState.token && !initialState.stats) {