mirror of
https://github.com/supabase/supabase.git
synced 2026-06-29 20:07:53 -04:00
143769afac
Add generic building blocks for blocking features on High Availability projects: - useHighAvailability hook: HA state only (isHighAvailability, isPending) - HighAvailabilityDisabledEmptyState (full-page empty state) - HighAvailabilityDisabledSectionNotice (in-section admonition) The components carry a generic default title/description; consuming pages pass their own copy via props. HA state is read from the project's high_availability flag (same source as the High Availability badge on the project home page). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added clearer messaging for features that aren’t available in High Availability projects. * Introduced a standard High Availability status check to help the app adapt what it shows. * **Bug Fixes** * Hid non-applicable schema options when High Availability is enabled, reducing confusion in selection lists. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
747 B
TypeScript
26 lines
747 B
TypeScript
import { MULTIGRES_SCHEMA_NAME, resolveHighAvailability } from './useHighAvailability.constants'
|
|
import { useSelectedProjectQuery } from './useSelectedProject'
|
|
|
|
export { MULTIGRES_SCHEMA_NAME, resolveHighAvailability }
|
|
|
|
export function useHighAvailability() {
|
|
const { data: project, isPending } = useSelectedProjectQuery()
|
|
|
|
const isHighAvailability = resolveHighAvailability(project)
|
|
|
|
return {
|
|
isHighAvailability,
|
|
isHighAvailabilityDisabled: !isHighAvailability,
|
|
isPending,
|
|
}
|
|
}
|
|
|
|
export function filterSchemasForHighAvailability<T extends { name: string }>(
|
|
schemas: T[],
|
|
isHighAvailability: boolean
|
|
) {
|
|
if (!isHighAvailability) return schemas
|
|
|
|
return schemas.filter((schema) => schema.name !== MULTIGRES_SCHEMA_NAME)
|
|
}
|