mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 23:59:08 +03:00
Fixes #42089 Supersedes #43352 and https://github.com/supabase/postgres-meta/pull/1049 ## Problem When creating a table in the Dashboard, if a column-specific error occurs (e.g., invalid enum value or broken foreign key), the Dashboard displays an error toast, but the side panel remains open. In the background, the table is actually created (partially), leading to a _42P07: relation already exists_ error if the user tries to click _Save_ again. ## Solution We actually had nested transactions which is not supported by Postgres. - [x] Allow generating SQL without transactions from `@supabase/pg-meta` - [x] Fix the table creation - [x] Fix some accessibility issues - [x] Add tests ## How to test 1. Click _New table_ in the Table editor 2. Add a column with an _int8_ type and set its default value to `bazinga` 3. Click _Save_ You should see an error. 4. Fix the default value by setting it to `10` 5. Click _Save_ Results: - You should see a success message about the table creation - The table should have the column with the correct default value
Writing components
Where to create your components
- For components that declare the general structure and layout of a page:
/components/layouts/xxx
- For components that are tightly coupled to a specific interface:
/components/interfaces/xxx
- For components that are meant to be reusable across multiple pages:
/components/ui/xxx
- Note: We're gradually moving files out of the
to-be-cleanedfolder into the respective folders as we refactor
Component structure
- If a component has constants and utility methods that are tightly coupled to itself, keep them close to the component and enclose them in a folder with an
index.tsxas an entry point - Otherwise it can just be a file on its own
- For example:
-
components/ui - SampleComponentA - SampleComponentA.tsx - SampleComponentA.constants.ts - SampleComponentA.utils.ts - SampleComponentA.types.ts - index.ts - SampleComponentB.tsx
-
Template for building components
// Declare the prop types of your component
interface ComponentAProps {
sampleProp: string
}
// Name your component accordingly
const ComponentA = ({ sampleProp }: ComponentAProps) => {
return <div>ComponentA: {sampleProp}</div>
}
export default ComponentA