Home / Function/ IndexAdvisorNotice() — supabase Function Reference

IndexAdvisorNotice() — supabase Function Reference

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

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/QueryPerformance/IndexAdvisor/IndexAdvisorNotice.tsx lines 10–60

export const IndexAdvisorNotice = () => {
  const { ref } = useParams()
  const { isIndexAdvisorAvailable, isIndexAdvisorEnabled } = useIndexAdvisorStatus()
  const [isDismissed, setIsDismissed] = useLocalStorageQuery(
    LOCAL_STORAGE_KEYS.INDEX_ADVISOR_NOTICE_DISMISSED(ref ?? ''),
    false
  )

  if (!isIndexAdvisorAvailable || isIndexAdvisorEnabled || isDismissed) return null

  return (
    <div className="px-6">
      <Admonition showIcon={false} type="tip" className="relative overflow-hidden mb-4">
        <div className="absolute -inset-16 z-0 opacity-50">
          <img
            src={`${BASE_PATH}/img/reports/bg-grafana-dark.svg`}
            alt="Index Advisor"
            className="w-full h-full object-cover object-right hidden dark:block"
          />
          <img
            src={`${BASE_PATH}/img/reports/bg-grafana-light.svg`}
            alt="Index Advisor"
            className="w-full h-full object-cover object-right dark:hidden"
          />
          <div className="absolute inset-0 bg-gradient-to-r from-background-alternative to-transparent" />
        </div>
        <div className="relative z-10 flex flex-col md:flex-row md:items-center gap-y-2 md:gap-x-8 justify-between px-2 py-1">
          <div className="flex flex-col gap-y-0.5">
            <div className="flex flex-col gap-y-2 items-start">
              <p className="text-sm font-medium">Enable Index Advisor</p>
            </div>
            <p className="text-sm text-foreground-lighter text-balance">
              Recommends indexes to improve query performance.
            </p>
          </div>
          <div className="flex items-center gap-x-2">
            <Button
              type="default"
              size="tiny"
              onClick={() => setIsDismissed(true)}
              aria-label="Dismiss notification"
            >
              Dismiss
            </Button>
            <EnableIndexAdvisorButton />
          </div>
        </div>
      </Admonition>
    </div>
  )
}

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free