Files
supabase/apps/studio/components
Drew McLellan ce5c68198c fix(studio): sort Postgres versions newest first in the version selector (#53278)
## Problem

The internal-only Postgres version selector sorted versions by raw
string comparison, so `17.6.1.164` appeared above `17.11.0.002` and the
list looked randomly ordered. The sort also ran in place on the array
returned by React Query, which can be the cached data.

Resolves FE-4603.

## Solution

- Add `sortPostgresVersionsNewestFirst` in `ProjectCreation.utils.ts`.
It compares version segments numerically, returns a new array, and does
not mutate its input.
- Use it in `PostgresVersionSelector` in place of `.sort().reverse()`.
- OrioleDB versions are not grouped; they are ordered by version number
like the rest.
- Side effect: the default selection (the first GA version in the list)
is now the newest GA version.
- Unit tests cover numeric ordering and non-mutation.

Before:
<img width="447" height="184" alt="Screenshot 2026-11-11 at 16 00 45"
src="https://github.com/user-attachments/assets/219f26a1-1475-40ce-a0dc-49480005194f"
/>

After:
<img width="448" height="196" alt="Screenshot 2026-11-11 at 15 58 32"
src="https://github.com/user-attachments/assets/24a99b91-22ff-4667-bf96-0046a426d95b"
/>
2026-11-12 13:53:15 +00:00
..

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-cleaned folder 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.tsx as 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>
}