Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Chore/fix connect UI pooler mode link (#22105)

Joshen Lim9f2c7c85712b
diff --git a/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.tsx b/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.tsx
index 8490ed6827b..3572341876b 100644
--- a/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.tsx
@@ -13,6 +13,7 @@ import {
DialogTitle,
Dialog,
IconExternalLink,
+ DialogSectionSeparator,
} from 'ui'
import { Markdown } from 'components/interfaces/Markdown'
@@ -40,9 +41,9 @@ export const PoolingModesModal = () => {
return (
<Dialog open={snap.showPoolingModeHelper} onOpenChange={snap.setShowPoolingModeHelper}>
- <DialogContent className="sm:max-w-4xl">
- <DialogHeader className="pr-8">
- <DialogTitle className="mb-4">
+ <DialogContent hideClose className="sm:max-w-4xl">
+ <DialogHeader className="pb-0">
+ <DialogTitle>
<div className="w-full flex items-center justify-between">
<p className="text-lg max-w-2xl">Which pooling mode should I use?</p>
<Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}>
@@ -56,13 +57,12 @@ export const PoolingModesModal = () => {
</Button>
</div>
</DialogTitle>
- <DialogDescription className="border-b pb-4 ">
- <p className="text-lg max-w-2xl">
- A connection pooler is a system (external to Postgres) which manages Postgres
- connections by allocating connections whenever clients make requests.
- </p>
+ <DialogDescription className="text-lg max-w-2xl">
+ A connection pooler is a system (external to Postgres) which manages Postgres
+ connections by allocating connections whenever clients make requests.
</DialogDescription>
</DialogHeader>
+ <DialogSectionSeparator />
<Markdown
className="px-6 max-w-full [&>h3]:text-sm"
content={`
@@ -83,27 +83,30 @@ This mode is similar to connecting to your database directly. There is full supp
`}
/>
{primaryConfig?.pool_mode === 'session' && (
- <Alert_Shadcn_ variant="warning">
- <AlertTriangleIcon strokeWidth={2} />
- <AlertTitle_Shadcn_>
- Pooling mode is currently configured to use session mode
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- To use transaction mode concurrently with session mode, change the pooling mode to
- transaction first in the{' '}
- <span
- tabIndex={0}
- className="text-foreground cursor-pointer underline underline-offset-2"
- onClick={() => {
- snap.setShowPoolingModeHelper(false)
- navigateToPoolerSettings()
- }}
- >
- connection pooling settings
- </span>
- . After this, you can use transaction mode on port 6543 and session mode on port 5432.
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
+ <div className="px-6">
+ <Alert_Shadcn_ variant="warning">
+ <AlertTriangleIcon strokeWidth={2} />
+ <AlertTitle_Shadcn_>
+ Pooling mode is currently configured to use session mode
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ To use transaction mode concurrently with session mode, change the pooling mode to
+ transaction first in the{' '}
+ <span
+ tabIndex={0}
+ className="text-foreground cursor-pointer underline underline-offset-2"
+ onClick={() => {
+ snap.setShowPoolingModeHelper(false)
+ navigateToPoolerSettings()
+ }}
+ >
+ connection pooling settings
+ </span>
+ . After this, you can use transaction mode on port 6543 and session mode on port
+ 5432.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ </div>
)}
<DialogFooter>
<DialogClose onClick={() => snap.setShowPoolingModeHelper(false)}>
diff --git a/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsx b/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsx
index 3249b13db58..163231b6902 100644
--- a/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsx
@@ -1,4 +1,5 @@
import { useParams } from 'common'
+import { useRouter } from 'next/router'
import { useState } from 'react'
import {
Badge,
@@ -20,6 +21,7 @@ import { useProjectSettingsQuery } from 'data/config/project-settings-query'
import { usePoolingConfigurationQuery } from 'data/database/pooling-configuration-query'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import { useDatabaseSettingsStateSnapshot } from 'state/database-settings'
+import Link from 'next/link'
interface UsePoolerCheckboxInterface {
id: string
@@ -36,6 +38,7 @@ export const UsePoolerCheckbox = ({
onCheckedChange,
onSelectPoolingMode,
}: UsePoolerCheckboxInterface) => {
+ const router = useRouter()
const [open, setOpen] = useState(false)
const { ref: projectRef } = useParams()
const { project } = useProjectContext()
@@ -46,6 +49,7 @@ export const UsePoolerCheckbox = ({
const { data: settings, isSuccess: isSuccessSettings } = useProjectSettingsQuery({ projectRef })
const { data: pgBouncerStatus } = usePgBouncerStatus({ projectRef: projectRef })
+ const isDatabaseSettingsPage = router.pathname.endsWith('/settings/database')
const readReplicasEnabled = project?.is_read_replicas_enabled
const poolingConfiguration = readReplicasEnabled
? data?.find((x) => x.identifier === state.selectedDatabaseId)
@@ -116,22 +120,31 @@ export const UsePoolerCheckbox = ({
<div className="px-2 text-xs flex flex-col gap-y-2">
<p>
To use transaction mode, change the pool mode in the{' '}
- <span
- tabIndex={0}
- className="underline hover:text-foreground cursor-pointer transition"
- onClick={() => {
- const el = document.getElementById('connection-pooler')
- if (el) {
- setOpen(false)
- el.scrollIntoView({
- behavior: 'smooth',
- block: 'center',
- })
- }
- }}
- >
- pooling configuration settings
- </span>{' '}
+ {isDatabaseSettingsPage ? (
+ <span
+ tabIndex={0}
+ className="underline hover:text-foreground cursor-pointer transition"
+ onClick={() => {
+ const el = document.getElementById('connection-pooler')
+ if (el) {
+ setOpen(false)
+ el.scrollIntoView({
+ behavior: 'smooth',
+ block: 'center',
+ })
+ }
+ }}
+ >
+ pooling configuration settings
+ </span>
+ ) : (
+ <Link
+ href={`/project/${projectRef}/settings/database#connection-pooler`}
+ className="underline hover:text-foreground"
+ >
+ pooling configuration settings
+ </Link>
+ )}{' '}
to use transaction mode first.
</p>
<p>