Home / Function/ useConnectCommands() — supabase Function Reference

useConnectCommands() — supabase Function Reference

Architecture documentation for the useConnectCommands() function in Connect.Commands.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/ConnectButton/Connect.Commands.tsx lines 10–47

export function useConnectCommands() {
  const setIsOpen = useSetCommandMenuOpen()
  const { data: selectedProject } = useSelectedProjectQuery()
  const isActiveHealthy = selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHY

  const [_, setShowConnect] = useQueryState('showConnect', parseAsBoolean.withDefault(false))
  const [__, setConnectTab] = useQueryState('connectTab', parseAsString)

  useRegisterCommands(
    COMMAND_MENU_SECTIONS.ACTIONS,
    [
      {
        id: 'connect-to-project',
        name: 'Connect to your project',
        action: () => {
          setShowConnect(true)
          setIsOpen(false)
        },
        icon: () => <Plug className="rotate-90" />,
      },
      {
        id: 'connect-mcp',
        name: 'Connect via MCP',
        action: () => {
          setShowConnect(true)
          setConnectTab('mcp')
          setIsOpen(false)
        },
        icon: () => <Plug className="rotate-90" />,
      },
    ] as ICommand[],
    {
      enabled: !!selectedProject && isActiveHealthy,
      orderSection: orderCommandSectionsByPriority,
      sectionMeta: { priority: 2 },
    }
  )
}

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free