Files
Manan GuptaandJoshen Lim 6a0518dd86 fix(studio): forward HA flag to project-creation pre-flight checks (#50902)
## Summary

- Fixes MUL-1678: toggling High Availability on in the project-creation
wizard 400'd for orgs that are HA-entitled but not enrolled in the "V3
rollout ramp" feature flag on the backend, because two pre-flight
endpoints Studio calls before project creation didn't know about HA and
hit the ramp check the real create-project call already bypasses.
- Threads `highAvailability` through
`useOrganizationAvailableRegionsQuery` (`GET
/platform/projects/available-regions`, sent as
`high_availability=true|false` on the query string) and
`useProjectCreationPostgresVersionsQuery` /
`useAvailableOrioleImageVersion` (`POST
/platform/organizations/:slug/available-versions`, sent as
`high_availability` in the body), including their query-key cache keys
so HA and non-HA responses for the same org/provider/size don't collide.
- Wires the (already form-tracked) `highAvailability` value into every
call site: `ProjectCreationForm.tsx`, `RegionSelector.tsx`, and a new
`highAvailability` prop on `PostgresVersionSelector.tsx` passed from
`InternalOnlyConfiguration.tsx`.

## Problem

The project-creation wizard's HA toggle is wired into the actual
project-create request, but two pre-flight calls Studio makes before
that (available regions, available Postgres versions) had no way to
signal HA, so the backend's ramp-flag gate rejected them for HA-entitled
orgs outside the ramp.

## Solution

Add an optional `highAvailability` field end-to-end on the Studio side:
query hook variables, cache keys, request serialization, and the
components that already track the toggle via `useWatch`.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Available regions and database versions in project creation now
reflect the selected high-availability setting.
* The Create button remains disabled while available regions are
loading.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: GuptaManan100 <guptamanan100@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-09-29 20:39:01 +05:30

43 lines
2.1 KiB
TypeScript

export const configKeys = {
settings: (projectRef: string | undefined) => ['projects', projectRef, 'settings'] as const,
settingsV2: (projectRef: string | undefined) => ['projects', projectRef, 'settings-v2'] as const,
api: (projectRef: string | undefined) => ['projects', projectRef, 'settings', 'api'] as const,
postgrest: (projectRef: string | undefined) => ['projects', projectRef, 'postgrest'] as const,
jwtSecretUpdatingStatus: (projectRef: string | undefined) =>
['projects', projectRef, 'jwt-secret-updating-status'] as const,
storage: (projectRef: string | undefined) => ['projects', projectRef, 'storage'] as const,
upgradeEligibility: (projectRef: string | undefined) =>
['projects', projectRef, 'upgrade-eligibility'] as const,
upgradeStatus: (projectRef: string | undefined) =>
['projects', projectRef, 'upgrade-status'] as const,
diskAttributes: (projectRef: string | undefined) =>
['projects', projectRef, 'disk-attributes'] as const,
diskBreakdown: (projectRef: string | undefined) =>
['projects', projectRef, 'disk-breakdown'] as const,
diskUtilization: (projectRef: string | undefined) =>
['projects', projectRef, 'disk-utilization'] as const,
projectCreationPostgresVersions: (
organizationSlug: string | undefined,
cloudProvider: string,
dbRegion: string,
highAvailability?: boolean
) =>
[
'projects',
organizationSlug,
cloudProvider,
dbRegion,
'available-creation-versions',
highAvailability,
] as const,
projectUnpausePostgresVersions: (projectRef: string | undefined) =>
['projects', projectRef, 'available-unpause-versions'] as const,
diskAutoscaleConfig: (projectRef: string | undefined) =>
['projects', projectRef, 'disk-autoscale-config'] as const,
deploymentMode: () => ['deployment-mode'] as const,
postgresConfig: (projectRef: string | undefined) =>
['projects', projectRef, 'postgres-config'] as const,
// used for entire project state, includes all configs, matches `config.toml` schema
projectConfig: (projectRef: string | undefined) => ['projects', projectRef, 'config'] as const,
}