Home / Function/ ComputeSizeRecommendationSection() — supabase Function Reference

ComputeSizeRecommendationSection() — supabase Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3a156a98_6e20_49a2_bf97_211c04127fcf["ComputeSizeRecommendationSection()"]
  5a5e7bf2_43db_cf41_0d0b_243b77c1d79d["calculateComputeSizeRequiredForIops()"]
  3a156a98_6e20_49a2_bf97_211c04127fcf -->|calls| 5a5e7bf2_43db_cf41_0d0b_243b77c1d79d
  6cd6e041_13bb_2d18_b691_8ab2924b736c["calculateMaxIopsForComputeSize()"]
  3a156a98_6e20_49a2_bf97_211c04127fcf -->|calls| 6cd6e041_13bb_2d18_b691_8ab2924b736c
  b53797de_ebc6_57df_780c_1f609f8111e4["mapAddOnVariantIdToComputeSize()"]
  3a156a98_6e20_49a2_bf97_211c04127fcf -->|calls| b53797de_ebc6_57df_780c_1f609f8111e4
  style 3a156a98_6e20_49a2_bf97_211c04127fcf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/DiskManagement/ui/ComputeSizeRecommendationSection.tsx lines 20–64

export function ComputeSizeRecommendationSection({
  actions,
  form,
}: ComputeSizeRecommendationSectionProps) {
  const { watch } = form
  const computeSize = watch('computeSize')
  const iops = watch('provisionedIOPS')

  const computeSizeRecommendedForIops = calculateComputeSizeRequiredForIops(iops)
  const maxIopsForComputeSize = calculateMaxIopsForComputeSize(computeSize ?? 'ci_micro')
  const isVisible =
    iops > maxIopsForComputeSize &&
    !RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3.includes(computeSize ?? 'ci_micro')

  return (
    <AnimatePresence initial={false}>
      {isVisible && (
        <motion.div
          initial={{ opacity: 0, height: 0 }}
          animate={{ opacity: 1, height: 'auto' }}
          exit={{ opacity: 0, height: 0 }}
          transition={{ duration: 0.15 }}
        >
          <Admonition
            type="default"
            title={`Your compute size baseline is ${COMPUTE_BASELINE_IOPS[computeSize ?? 'ci_micro']} IOPS (max ${COMPUTE_MAX_IOPS[computeSize ?? 'ci_micro'] ?? maxIopsForComputeSize} IOPS)`}
          >
            <div className="flex flex-col gap-2">
              <div>
                <p className="text-sm text-foreground-light">
                  To achieve higher IOPS performance we recommend using the{' '}
                  <span className="text-foreground">
                    {mapAddOnVariantIdToComputeSize(computeSizeRecommendedForIops)}
                  </span>{' '}
                  compute size.
                </p>
              </div>
              {actions && <div>{actions}</div>}
            </div>
          </Admonition>
        </motion.div>
      )}
    </AnimatePresence>
  )
}

Subdomains

Frequently Asked Questions

What does ComputeSizeRecommendationSection() do?
ComputeSizeRecommendationSection() is a function in the supabase codebase.
What does ComputeSizeRecommendationSection() call?
ComputeSizeRecommendationSection() calls 3 function(s): calculateComputeSizeRequiredForIops, calculateMaxIopsForComputeSize, mapAddOnVariantIdToComputeSize.

Analyze Your Own Codebase

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

Try Supermodel Free