Files
Lukas Klingsbo 8963a05479 chore(studio): drop anon key wording from connect snippet placeholders (#51793)
## Problem

Several snippets in the dashboard Connect sheet still mention anon keys
in placeholder text, even though publishable keys are now the
recommended client key:

- Swift, Kotlin, Expo, Ionic React and Ionic Angular show `<prefer
publishable key instead of anon key ...>` when the project has no
publishable key.
- Astro, Nuxt, Refine, TanStack, Flask and the three .NET snippets fall
back to `your-anon-key` when the project has neither key.
- Ionic React stores the key in a variable called `supabaseAnonKey`.

## Solution

- Both placeholders become `your-publishable-key`.
- The Ionic React variable becomes `supabaseKey`, matching the other
snippets.

Snippets that switch to `*_ANON_KEY` environment variables for projects
with only legacy keys (Next.js, Vite, SvelteKit and others) are
unchanged. There, `your-anon-key` still matches the variable name.

The Flutter snippet is handled separately in #51792.

## Review instructions

1. Open the Connect sheet for a project without a publishable key.
2. Go through the frameworks listed above and check that the
placeholders say `your-publishable-key`.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
2026-10-16 13:30:08 +02:00

102 lines
2.2 KiB
TypeScript

import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
const ContentFile = ({ projectKeys }: StepContentProps) => {
const files = [
{
name: '.env',
language: 'bash',
code: `
REACT_APP_SUPABASE_URL=${projectKeys.apiUrl ?? 'your-project-url'}
REACT_APP_SUPABASE_KEY=${projectKeys.publishableKey ?? 'your-publishable-key'}
`,
},
{
name: 'src/supabaseClient.tsx',
language: 'ts',
code: `
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL
const supabaseKey = process.env.REACT_APP_SUPABASE_KEY
export const supabase = createClient(supabaseUrl, supabaseKey)
`,
},
{
name: 'src/App.tsx',
language: 'ts',
code: `
import React, { useEffect, useState } from 'react';
import { setupIonicReact, IonApp } from '@ionic/react';
import {
IonContent,
IonHeader,
IonTitle,
IonToolbar,
IonList,
IonItem,
} from '@ionic/react';
/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
/* Theme variables */
import './theme/variables.css';
import { supabase } from './supabaseClient';
setupIonicReact();
export default function App() {
const [todos, setTodos] = useState([]);
useEffect(() => {
getTodos();
}, []);
const getTodos = async () => {
try {
const { data, error } = await supabase.from('todos').select();
if (error) {
console.error('Error fetching todos:', error.message);
return;
}
if (data) {
setTodos(data);
}
} catch (error) {
console.error('Error fetching todos:', error.message);
}
};
return (
<IonApp>
<>
<IonHeader>
<IonToolbar>
<IonTitle>Todos</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
<IonList>
{todos.map((todo) => (
<IonItem key={todo.id}>{todo.name}</IonItem>
))}
</IonList>
</IonContent>
</>
</IonApp>
);
}
`,
},
]
return <MultipleCodeBlock files={files} />
}
export default ContentFile