mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 22:29:11 +03:00
## Problem Project creation can send a request without a region, which the API rejects. Empty region values pass frontend validation, and a failed available-regions request fills in a static region name that cannot resolve to a region selection. ## Fix Keep the region selector controlled from mount and require a nonempty value. Disable creation when available regions fail to load, guard submission against unresolved region selections, and preserve the static fallback for providers that use it. Fixes [FE-3884](https://linear.app/supabase/issue/FE-3884/project-creation-wizard-can-submit-with-an-empty-region). ## How to test - Open the new-project form and verify the recommended region submits without manually selecting a region. - Submit with an empty region. Expected result: an inline validation error appears and no project creation request is sent. - Fail the available-regions endpoint, including after changing compute size with a region already selected. Expected result: the region-loading error appears, creation is disabled, and direct form submission sends no project creation request. - Run `pnpm --filter studio exec vitest --run 'tests/pages/new/[slug].test.tsx' tests/pages/vercel-deploy-button-new-project.test.tsx components/interfaces/ProjectCreation/ProjectCreation.schema.test.ts`. Local validation: all 54 focused tests and formatting pass. Focused ESLint has no errors. Local typecheck reports the existing image type mismatch in InstructionBlocks.tsx; CI typecheck passed for the previous commit.
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 — use a named export, not a default export
export const ComponentA = ({ sampleProp }: ComponentAProps) => {
return <div>ComponentA: {sampleProp}</div>
}