The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix new replica click (#35808)
Jordi Enricd61d32f007ff
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsxindex d9a59026d8c..520c479d647 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx@@ -36,6 +36,7 @@ import { TIME_PERIODS_BILLING, TIME_PERIODS_REPORTS } from 'lib/constants/metricimport { useDatabaseSelectorStateSnapshot } from 'state/database-selector'import { Admonition } from 'ui-patterns/admonition'import { INFRA_ACTIVITY_METRICS } from './Infrastructure.constants'+import { useShowNewReplicaPanel } from './InfrastructureConfiguration/use-show-new-replica'const NON_DEDICATED_IO_RESOURCES = ['ci_micro',@@ -64,6 +65,8 @@ const InfrastructureActivity = () => {const { data: addons } = useProjectAddonsQuery({ projectRef })const selectedAddons = addons?.selected_addons ?? []+ const { showNewReplicaPanel, setShowNewReplicaPanel } = useShowNewReplicaPanel()+const { computeInstance } = getAddons(selectedAddons)const hasDedicatedIOResources =computeInstance !== undefined &&@@ -211,7 +214,11 @@ const InfrastructureActivity = () => {</ScaffoldContainer><ScaffoldContainer className="sticky top-0 py-6 border-b bg-studio z-10"><div className="flex items-center gap-x-4">- <DatabaseSelector />+ <DatabaseSelector+ onCreateReplicaClick={() => {+ setShowNewReplicaPanel(true)+ }}+ />{!isLoadingSubscription && (<><DateRangePickerdiff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxindex 42b0d0818ca..d1edc21905d 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx@@ -39,6 +39,7 @@ import { addRegionNodes, generateNodes, getDagreGraphLayout } from './InstanceCoimport { LoadBalancerNode, PrimaryNode, RegionNode, ReplicaNode } from './InstanceNode'import MapView from './MapView'import { RestartReplicaConfirmationModal } from './RestartReplicaConfirmationModal'+import { useShowNewReplicaPanel } from './use-show-new-replica'const InstanceConfigurationUI = () => {const reactFlow = useReactFlow()@@ -50,7 +51,7 @@ const InstanceConfigurationUI = () => {const [view, setView] = useState<'flow' | 'map'>('flow')const [showDeleteAllModal, setShowDeleteAllModal] = useState(false)- const [showNewReplicaPanel, setShowNewReplicaPanel] = useState(false)+ const { showNewReplicaPanel, setShowNewReplicaPanel } = useShowNewReplicaPanel()const [refetchInterval, setRefetchInterval] = useState<number | boolean>(10000)const [newReplicaRegion, setNewReplicaRegion] = useState<AWS_REGIONS_KEYS>()const [selectedReplicaToDrop, setSelectedReplicaToDrop] = useState<Database>()diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/use-show-new-replica.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/use-show-new-replica.tsxnew file mode 100644index 00000000000..0213133f084--- /dev/null+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/use-show-new-replica.tsx@@ -0,0 +1,10 @@+import { useQueryState, parseAsBoolean } from 'nuqs'++export function useShowNewReplicaPanel() {+ const [showNewReplicaPanel, setShowNewReplicaPanel] = useQueryState(+ 'createReplica',+ parseAsBoolean.withDefault(false)+ )++ return { showNewReplicaPanel, setShowNewReplicaPanel }+}diff --git a/apps/studio/components/ui/DatabaseSelector.tsx b/apps/studio/components/ui/DatabaseSelector.tsxindex 649261b1061..2a9f04da1a2 100644--- a/apps/studio/components/ui/DatabaseSelector.tsx+++ b/apps/studio/components/ui/DatabaseSelector.tsx@@ -35,6 +35,7 @@ interface DatabaseSelectorProps {additionalOptions?: { id: string; name: string }[]buttonProps?: ButtonPropsonSelectId?: (id: string) => void // Optional callback+ onCreateReplicaClick?: () => void}const DatabaseSelector = ({@@ -43,6 +44,7 @@ const DatabaseSelector = ({additionalOptions = [],onSelectId = noop,buttonProps,+ onCreateReplicaClick = noop,}: DatabaseSelectorProps) => {const router = useRouter()const { ref: projectRef } = useParams()@@ -215,6 +217,7 @@ const DatabaseSelector = ({setOpen(false)// [Joshen] This is used in the Connect UI which is available across all pagessetShowConnect(null)+ onCreateReplicaClick?.()}}className="w-full flex items-center gap-2">