Home / Function/ PurgeQueue() — supabase Function Reference

PurgeQueue() — supabase Function Reference

Architecture documentation for the PurgeQueue() function in PurgeQueue.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/Integrations/Queues/SingleQueue/PurgeQueue.tsx lines 13–60

export const PurgeQueue = ({ queueName, visible, onClose }: PurgeQueueProps) => {
  const { data: project } = useSelectedProjectQuery()

  const { mutate: purgeDatabaseQueue, isPending } = useDatabaseQueuePurgeMutation({
    onSuccess: () => {
      toast.success(`Successfully purged queue ${queueName}`)
      onClose()
    },
  })

  async function handlePurge() {
    if (!project) return console.error('Project is required')

    purgeDatabaseQueue({
      queueName: queueName,
      projectRef: project.ref,
      connectionString: project.connectionString,
    })
  }

  if (!queueName) {
    return null
  }

  return (
    <TextConfirmModal
      variant="warning"
      visible={visible}
      onCancel={() => onClose()}
      onConfirm={handlePurge}
      title="Purge this queue"
      loading={isPending}
      confirmLabel={`Purge queue ${queueName}`}
      confirmPlaceholder="Type in name of queue"
      confirmString={queueName ?? 'Unknown'}
      text={
        <>
          <span>This will purge the queue</span>{' '}
          <span className="text-bold text-foreground">{queueName}</span>
        </>
      }
      alert={{
        title:
          "This action will delete all messages from the queue. They can't be recovered afterwards.",
      }}
    />
  )
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free