DestinationPanel() — supabase Function Reference
Architecture documentation for the DestinationPanel() function in DestinationPanel.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 5e1e75ab_01c8_c6ad_e6b7_8db861ff91e9["DestinationPanel()"] a44cf10c_5832_090d_46cf_bd19c9868b81["useIsETLPrivateAlpha()"] 5e1e75ab_01c8_c6ad_e6b7_8db861ff91e9 -->|calls| a44cf10c_5832_090d_46cf_bd19c9868b81 ad7996f0_8f4c_16e7_8b83_e7a2b844257a["useDestinationInformation()"] 5e1e75ab_01c8_c6ad_e6b7_8db861ff91e9 -->|calls| ad7996f0_8f4c_16e7_8b83_e7a2b844257a style 5e1e75ab_01c8_c6ad_e6b7_8db861ff91e9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx lines 35–171
export const DestinationPanel = ({ onSuccessCreateReadReplica }: DestinationPanelProps) => {
const enablePgReplicate = useIsETLPrivateAlpha()
const unifiedReplication = useFlag('unifiedReplication')
const { hasAccess: hasETLReplicationAccess } = useCheckEntitlements('replication.etl')
const [urlDestinationType, setDestinationType] = useQueryState(
'type',
parseAsStringEnum<DestinationType>([
'Read Replica',
'BigQuery',
'Analytics Bucket',
]).withOptions({
history: 'push',
clearOnDefault: true,
})
)
const [edit, setEdit] = useQueryState(
'edit',
parseAsInteger.withOptions({
history: 'push',
clearOnDefault: true,
})
)
const visible = urlDestinationType !== null || edit !== null
const editMode = edit !== null
const {
sourceId,
pipeline,
statusName,
replicationNotEnabled,
type: existingDestinationType,
destinationFetcher,
} = useDestinationInformation({ id: edit })
const destinationType = existingDestinationType ?? urlDestinationType
const invalidExistingDestination = destinationFetcher.error?.code === 404
const existingDestination = editMode
? {
sourceId,
destinationId: edit,
pipelineId: pipeline?.id,
statusName,
enabled:
statusName === PipelineStatusName.STARTED || statusName === PipelineStatusName.FAILED,
}
: undefined
const onClose = () => {
setDestinationType(null)
setEdit(null)
}
useEffect(() => {
if (edit !== null && invalidExistingDestination) {
toast(`Unable to find destination ID ${edit}`)
setEdit(null)
}
}, [edit, invalidExistingDestination, setEdit])
return (
<>
<Sheet open={visible} onOpenChange={onClose}>
<SheetContent
size="default"
showClose={false}
className={cn(unifiedReplication ? 'md:!w-[850px]' : 'md:!w-[700px]')}
>
<div className="flex flex-col h-full" tabIndex={-1}>
<SheetHeader>
<SheetTitle>{editMode ? 'Edit destination' : 'Create a new destination'}</SheetTitle>
<SheetDescription>
{editMode
? 'Update the configuration for this destination'
: 'A destination is an external platform that automatically receives your database changes in real time.'}
</SheetDescription>
</SheetHeader>
<DestinationTypeSelection />
<DialogSectionSeparator />
{destinationType === 'Read Replica' ? (
<ReadReplicaForm onClose={onClose} onSuccess={() => onSuccessCreateReadReplica?.()} />
) : unifiedReplication && !enablePgReplicate ? (
<SheetSection>
<div className={cn('border rounded-md p-6 flex flex-col gap-y-4')}>
<div className="flex flex-col gap-y-1">
<h4>Replicate data to external destinations in real-time</h4>
<p className="text-sm text-foreground-light">
We are currently in <span className="text-foreground">private alpha</span> and
slowly onboarding new customers to ensure stable data pipelines. Request
access below to join the waitlist. Read replicas are available now.
</p>
</div>
<div className="flex gap-x-2">
<Button
asChild
type="secondary"
iconRight={<ArrowUpRight size={16} strokeWidth={1.5} />}
>
<Link
href="https://forms.supabase.com/pg_replicate"
target="_blank"
rel="noreferrer"
>
Request alpha access
</Link>
</Button>
<DocsButton href={`${DOCS_URL}/guides/database/replication#replication`} />
</div>
</div>
</SheetSection>
) : unifiedReplication && replicationNotEnabled ? (
<SheetSection>
<EnableReplicationCallout
className="!p-6"
type={destinationType}
hasAccess={hasETLReplicationAccess}
/>
</SheetSection>
) : (
<DestinationForm
visible={visible}
selectedType={destinationType ?? 'Read Replica'}
existingDestination={existingDestination}
onClose={onClose}
/>
)}
</div>
</SheetContent>
</Sheet>
</>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does DestinationPanel() do?
DestinationPanel() is a function in the supabase codebase.
What does DestinationPanel() call?
DestinationPanel() calls 2 function(s): useDestinationInformation, useIsETLPrivateAlpha.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free