Skip to content

Joshen/fe 2285 shift read replicas into database replication section - #41486

Merged
joshenlim merged 4 commits into
masterfrom
joshen/fe-2285-shift-read-replicas-into-database-replication-section
Dec 20, 2025
Merged

joshenlim merged 4 commits into
masterfrom
joshen/fe-2285-shift-read-replicas-into-database-replication-section

Conversation

@joshenlim

@joshenlim joshenlim commented Dec 19, 2025 •

Copy link
Copy Markdown
Member

Context

Related project: https://linear.app/supabase/project/unify-read-replicas-with-replication-page-f0feb52cf161/overview

Implements creation of read replicas from the replication UI page of the Database Section
It's the same thing as per what was on the project settings -> infrastructure page, also has all the relevant warnings.

image image

To test

Note that the changes here only supports creating read replicas, but not showing replicas in the replication UI yet, so I reckon it might be better to test locally

Firstly - you'll want to change unifiedReplication to false in InfrastructureInfo so that you can verify that the replicas are getting deployed. I won't go too much into detail on how to ensure that you project is eligible to deploy read replicas as I'd also like to verify that all the necessary warnings / CTAs are in place to guide the users to land in an eligible state, so let me know if anything's missing 🙏

  • Verify that you can deploy a read replica from the replication UI
    • There'll be nothing shown in the replication UI atm, so verify that the replica is deployed from the project settings -> infrastructure page

Summary by CodeRabbit

  • New Features

    • Read replica deployment flow: region selector, deploy action, and in-app pricing dialog with detailed cost breakdown.
  • UX / Warnings

    • Comprehensive eligibility guidance with actionable prompts (billing, backups, compute, version limits, max replicas) and contextual next steps.
  • UI Improvements

    • Styling hook (className) added to upgrade/billing buttons for easier customization.

✏️ Tip: You can customize this high-level summary in your review settings.

@joshenlim
joshenlim requested a review from a team as a code owner December 19, 2025 09:01
@vercel

vercel Bot commented Dec 19, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Dec 20, 2025 8:26am
studio-staging Ready Ready Preview, Comment Dec 20, 2025 8:26am
6 Skipped Deployments
Project Deployment Review Updated (UTC)
studio Ignored Ignored Dec 20, 2025 8:26am
cms Skipped Skipped Dec 20, 2025 8:26am
design-system Skipped Skipped Dec 20, 2025 8:26am
docs Skipped Skipped Dec 20, 2025 8:26am
ui-library Skipped Skipped Dec 20, 2025 8:26am
zone-www-dot-com Skipped Skipped Dec 20, 2025 8:26am

@supabase

supabase Bot commented Dec 19, 2025

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Replaces the DestinationPanel placeholder with a new ReadReplicaForm and adds supporting hooks and UI: eligibility checks, pricing calculation and dialog, eligibility warnings, deployment mutation, and minor UI prop/routing changes. (46 words)

Changes

Cohort / File(s) Summary
Destination Panel Integration
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx
Renders ReadReplicaForm when selected type is "Read Replica" instead of the previous placeholder.
Read Replica Form & Hooks
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx, apps/studio/.../useCheckEligibilityDeployReplica.ts, apps/studio/.../useGetReplicaCost.ts
New ReadReplicaForm with region selection, validation, deployment mutation and cost preview; useCheckEligibilityDeployReplica computes multi-factor eligibility; useGetReplicaCost calculates compute/disk/iops/throughput costs and aggregates total.
Eligibility Warnings & Pricing UI
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx, .../ReadReplicaPricingDialog.tsx
New components: contextual eligibility admonitions and actions; pricing dialog with AWS vs non‑AWS variants and cost breakdown.
UI Button Props & Routing
apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx, apps/studio/components/ui/UpgradePlanButton.tsx
Added optional className prop to both components for styling; UpgradePlanButton routing updated for computeSize addon to point to compute-and-disk settings.

Sequence Diagram

sequenceDiagram
    autonumber
    participant User
    participant UI as ReadReplicaForm
    participant Eligibility as useCheckEligibilityDeployReplica
    participant Cost as useGetReplicaCost
    participant Warnings as ReadReplicaEligibilityWarnings
    participant Pricing as ReadReplicaPricingDialog
    participant API as ReadReplicaSetupMutation

    User->>UI: open form
    UI->>Eligibility: fetch eligibility flags
    Eligibility-->>UI: eligibility + reasons
    UI->>Cost: fetch cost breakdown
    Cost-->>UI: compute/disk/iops/throughput

    alt not eligible
        UI->>Warnings: render warnings/actions
        Warnings-->>User: show blockers (invoices, provider, version, backups, spend cap, limits)
    else eligible
        UI-->>User: show region selector & summary
        User->>Pricing: "Learn more"
        Pricing-->>User: show detailed cost dialog
    end

    User->>UI: submit deploy
    UI->>API: call setup mutation
    API-->>UI: success / error
    UI-->>User: toast + close on success
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay extra attention to:
    • useCheckEligibilityDeployReplica.ts (many conditional rules and derived flags)
    • useGetReplicaCost.ts (pricing formulas, unit conversions, edge cases)
    • ReadReplicaEligibilityWarnings.tsx (multiple conditional UI paths and enablement flow)
    • ReadReplicaForm/index.tsx (submission, validation, mutation handling)

Possibly related PRs

Suggested reviewers

  • alaister
  • awaseem
  • kemaldotearth

Poem

🐰 I hopped to a panel where replicas may grow,
Regions and costs in a neat little row,
Warnings keep watch and pricing sings true,
Click deploy, watch the mirror appear too —
The rabbit applauds: "Good luck — ping me when new!"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description covers context, objectives, testing instructions, and references the related Linear project, but does not follow the repository's template structure with the required sections. Update the description to follow the template: add 'I have read CONTRIBUTING.md' confirmation, specify 'feature' as the change type, include 'current behavior' section, and organize content under the template's required sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly relates to the main objective of shifting read replica creation into the database replication section, accurately summarizing the primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch joshen/fe-2285-shift-read-replicas-into-database-replication-section

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (8)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1)

23-26: Unnecessary useMemo for a simple computation.

The includes check on a small static array is inexpensive. useMemo adds overhead without benefit here.

🔎 Suggested simplification
-  const isNotOnHigherPlan = useMemo(
-    () => !['team', 'enterprise', 'platform'].includes(org?.plan.id ?? ''),
-    [org]
-  )
+  const isNotOnHigherPlan = !['team', 'enterprise', 'platform'].includes(org?.plan.id ?? '')
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts (3)

29-30: Avoid @ts-ignore; prefer runtime validation.

Per coding guidelines, avoid type casting. Consider using a zod schema to validate diskConfiguration.attributes at runtime, or update the API types if they're incorrect.


32-49: Multiple type casts weaken type safety.

The type as DiskType casts on lines 33, 35, and 44 assume the API returns a valid DiskType. If the API returns an unexpected value, pricing calculations may silently use fallback values. Consider validating type against DiskType enum values before use.

🔎 Suggested validation approach
const diskType = Object.values(DiskType).includes(type) ? (type as DiskType) : undefined

51-56: Inconsistent number coercion style.

Lines 54-55 use Number() while lines 72 and 76 use unary +. Consider using a consistent approach throughout for readability.

Also applies to: 70-77

apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1)

32-36: Consider using a <button> element for the dialog trigger.

The <p> element styled as a link may cause accessibility issues. Screen readers expect interactive elements to be buttons or links. The DialogTrigger typically expects an interactive child.

🔎 Suggested fix
       <DialogTrigger>
-        <p className={cn(InlineLinkClassName, 'text-sm text-foreground-light cursor-pointer')}>
+        <button
+          type="button"
+          className={cn(InlineLinkClassName, 'text-sm text-foreground-light cursor-pointer')}
+        >
           Learn more
-        </p>
+        </button>
       </DialogTrigger>
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx (2)

37-39: Clarify the default region fallback logic.

The destructuring pattern with ?? ['ap-southeast-1'] works but is subtle. If AWS_REGIONS_DEFAULT isn't found, the fallback assumes 'ap-southeast-1' is a valid key in AWS_REGIONS.

🔎 Consider a more explicit approach
-  const [defaultRegion] = Object.entries(AWS_REGIONS).find(
-    ([_, name]) => name === AWS_REGIONS_DEFAULT
-  ) ?? ['ap-southeast-1']
+  const defaultRegionEntry = Object.entries(AWS_REGIONS).find(
+    ([_, name]) => name === AWS_REGIONS_DEFAULT
+  )
+  const defaultRegion = defaultRegionEntry?.[0] ?? 'ap-southeast-1'

This makes the fallback behavior clearer and easier to verify.


33-135: Consider react-hook-form for consistency.

Based on learnings, the codebase standard is to build forms with react-hook-form and zod for validation. While the current implementation works fine for this simple single-field form, using the standard form pattern would improve consistency and make future enhancements easier.

This is a minor suggestion—the current approach is reasonable given the form's simplicity.

apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (1)

154-203: Extract conditional content to improve readability.

The WALG warning block contains nested ternaries and conditional rendering based on refetchInterval. Per coding guidelines, nested ternaries in JSX should be avoided. Consider extracting the conditional content into variables.

🔎 Proposed refactor
+  const isEnablingBackups = refetchInterval !== false
+  const backupTitle = isEnablingBackups
+    ? 'Physical backups are currently being enabled'
+    : 'Physical backups are required to deploy replicas'
+  
+  const backupDescription = isEnablingBackups ? (
+    <>
+      <p>
+        This warning will go away once physical backups have been enabled - check back in a
+        few minutes!
+      </p>
+      <p>You may start deploying read replicas thereafter once this is completed.</p>
+    </>
+  ) : (
+    <>
+      <p>
+        Physical backups are used under the hood to spin up read replicas for your project.
+      </p>
+      <p>
+        Enabling physical backups will take a few minutes, after which you will be able to
+        deploy read replicas.
+      </p>
+    </>
+  )
+
   if (isWalgNotEnabled) {
     return (
-      <Admonition
-        type="warning"
-        title={
-          refetchInterval === false
-            ? 'Physical backups are required to deploy replicas'
-            : 'Physical backups are currently being enabled'
-        }
-      >
-        {refetchInterval === false ? (
-          <>
-            <p>
-              Physical backups are used under the hood to spin up read replicas for your project.
-            </p>
-            <p>
-              Enabling physical backups will take a few minutes, after which you will be able to
-              deploy read replicas.
-            </p>
-          </>
-        ) : (
-          <>
-            <p>
-              This warning will go away once physical backups have been enabled - check back in a
-              few minutes!
-            </p>
-            <p>You may start deploying read replicas thereafter once this is completed.</p>
-          </>
-        )}
-        {refetchInterval === false && (
+      <Admonition type="warning" title={backupTitle}>
+        {backupDescription}
+        {!isEnablingBackups && (
           <div className="flex items-center gap-x-2 mt-2">
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbeb091 and b04e6b2.

📒 Files selected for processing (8)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (2 hunks)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (1 hunks)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1 hunks)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx (1 hunks)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1 hunks)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts (1 hunks)
  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx (3 hunks)
  • apps/studio/components/ui/UpgradePlanButton.tsx (6 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g., as any, as Type); instead validate values at runtime using zod schemas

Files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts
  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts
  • apps/studio/components/ui/UpgradePlanButton.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
apps/studio/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: use on prefix for prop callbacks and handle prefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers

Files:

  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx
  • apps/studio/components/ui/UpgradePlanButton.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
🧠 Learnings (11)
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts
  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts
  • apps/studio/components/ui/UpgradePlanButton.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
📚 Learning: 2025-12-11T16:46:18.701Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-best-practices.mdc:0-0
Timestamp: 2025-12-11T16:46:18.701Z
Learning: Applies to apps/studio/**/*.tsx : Define prop interfaces explicitly for React components with proper typing of props and callback handlers

Applied to files:

  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx
  • apps/studio/components/ui/UpgradePlanButton.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Do not introduce new UI components unless asked to; check packages/ui/index.tsx for available components before composing interfaces

Applied to files:

  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx
  • apps/studio/components/ui/UpgradePlanButton.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/**/*.{ts,tsx} : Use _Shadcn_ suffixed components (e.g., Input_Shadcn_, Button_Shadcn_) from the ui package where possible

Applied to files:

  • apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx
  • apps/studio/components/ui/UpgradePlanButton.tsx
📚 Learning: 2025-12-11T16:46:18.701Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-best-practices.mdc:0-0
Timestamp: 2025-12-11T16:46:18.701Z
Learning: Applies to apps/studio/**/*.{ts,tsx} : Extract complex logic into custom hooks when logic becomes reusable or complex

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/**/*.{ts,tsx} : Use typography classes from apps/studio/styles/typography.scss (e.g., 'heading-default') instead of hard-coding Tailwind classes for typography styles

Applied to files:

  • apps/studio/components/ui/UpgradePlanButton.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : When submit button is outside the form, add a formId variable outside the component, set it as id on form element and form prop on the button

Applied to files:

  • apps/studio/components/ui/UpgradePlanButton.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Admonition component to alert users of important actions or restrictions

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Build forms with react-hook-form and zod for validation

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/interfaces/**/*.{ts,tsx} : Create a new component in apps/studio/components/interfaces for the contents of each new page

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use sheets when revealing complicated forms or information relating to an object where context switching to a new page would be disruptive

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx
🧬 Code graph analysis (5)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts (1)
apps/studio/lib/helpers.ts (1)
  • formatCurrency (329-337)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (2)
apps/studio/hooks/misc/useSelectedProject.ts (2)
  • useIsAwsK8sCloudProvider (26-31)
  • useSelectedProjectQuery (5-17)
apps/studio/hooks/misc/useSelectedOrganization.ts (1)
  • useSelectedOrganizationQuery (5-21)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (8)
apps/studio/hooks/misc/useSelectedOrganization.ts (1)
  • useSelectedOrganizationQuery (5-21)
apps/studio/hooks/misc/useSelectedProject.ts (1)
  • useSelectedProjectQuery (5-17)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1)
  • useCheckEligibilityDeployReplica (14-83)
apps/studio/data/projects/project-detail-query.ts (1)
  • useProjectDetailQuery (42-66)
packages/ui-patterns/src/admonition.tsx (1)
  • Admonition (83-180)
apps/studio/lib/constants/index.ts (1)
  • DOCS_URL (48-48)
apps/studio/components/interfaces/Support/SupportLink.tsx (1)
  • SupportLink (7-28)
apps/studio/components/ui/UpgradePlanButton.tsx (1)
  • UpgradePlanButton (34-117)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx (4)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts (1)
  • useGetReplicaCost (14-79)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1)
  • useCheckEligibilityDeployReplica (14-83)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (1)
  • ReadReplicaEligibilityWarnings (20-251)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1)
  • ReadReplicaPricingDialog (24-114)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx (1)
  • ReadReplicaForm (33-136)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: typecheck
  • GitHub Check: test
  • GitHub Check: test (1)
🔇 Additional comments (8)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (2)

59-69: Well-structured eligibility check.

The conjunction of conditions is clear and the returned object provides all necessary flags for UI consumption. This follows the coding guidelines for custom hooks returning objects.


55-57: Version parsing relies on a specific string format.

If dbVersion doesn't follow the supabase-postgres-X.Y.Z format, currentPgVersion becomes NaN. While the >= 15 comparison safely returns false, this is non-obvious. Consider adding a fallback or explicit check.

#!/bin/bash
# Check how dbVersion is typically formatted in the codebase
rg -n "dbVersion" --type=ts -C2 | head -50
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1)

46-105: Clean conditional rendering for AWS vs non-AWS providers.

The ternary for binary choice pattern is appropriate here and the table structure is well-organized with proper semantic elements.

apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (2)

69-70: Consider passing onSuccess for potential data refresh.

ReadReplicaForm accepts an optional onSuccess callback (visible in the relevant code snippet at lines 32-135). While omitting it works, you may want to pass a callback to trigger data refetch or UI updates after replica deployment.


16-16: LGTM on the import and integration.

The ReadReplicaForm is properly imported and conditionally rendered based on selectedType.

apps/studio/components/ui/RequestUpgradeToBillingOwners.tsx (1)

50-51: LGTM on the className prop addition.

The prop is correctly typed as optional, destructured from props, and applied to the Button. This follows the coding guidelines for explicit prop interfaces with proper typing.

Also applies to: 59-60, 159-159

apps/studio/components/ui/UpgradePlanButton.tsx (1)

26-26: LGTM! Clean styling and routing enhancements.

The className prop is properly threaded through all rendering paths, and the computeSize routing logic correctly directs users to the compute-and-disk settings page. The implementation maintains consistency with existing patterns.

Also applies to: 42-42, 67-69, 87-87, 99-99, 113-113

apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (1)

20-251: Component structure is reasonable for its purpose.

At 251 lines, this component approaches the upper guideline of 200-300 lines. However, the structure is appropriate given that it orchestrates multiple distinct eligibility checks with early returns. Each conditional block is a self-contained warning, making the logic clear despite the length.

If more eligibility conditions are added in the future, consider extracting a helper function to render common Admonition patterns with actions.

Comment on lines +61 to +68
const onSubmit = async () => {
const regionKey = AWS_REGIONS[selectedRegion as AWS_REGIONS_KEYS].code
if (!projectRef) return console.error('Project is required')
if (!regionKey) return toast.error('Unable to deploy replica: Unsupported region selected')

const primary = data?.find((db) => db.identifier === projectRef)
setUpReplica({ projectRef, region: regionKey as Region, size: primary?.size ?? 't4g.small' })
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace console.error with proper error handling.

Line 63 uses console.error which is inappropriate for user-facing errors. While this branch should be unreachable due to the guard conditions, it's better to provide user feedback.

🔎 Proposed fix
-    if (!projectRef) return console.error('Project is required')
+    if (!projectRef) {
+      toast.error('Unable to deploy replica: Project reference not found')
+      return
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const onSubmit = async () => {
const regionKey = AWS_REGIONS[selectedRegion as AWS_REGIONS_KEYS].code
if (!projectRef) return console.error('Project is required')
if (!regionKey) return toast.error('Unable to deploy replica: Unsupported region selected')
const primary = data?.find((db) => db.identifier === projectRef)
setUpReplica({ projectRef, region: regionKey as Region, size: primary?.size ?? 't4g.small' })
}
const onSubmit = async () => {
const regionKey = AWS_REGIONS[selectedRegion as AWS_REGIONS_KEYS].code
if (!projectRef) {
toast.error('Unable to deploy replica: Project reference not found')
return
}
if (!regionKey) return toast.error('Unable to deploy replica: Unsupported region selected')
const primary = data?.find((db) => db.identifier === projectRef)
setUpReplica({ projectRef, region: regionKey as Region, size: primary?.size ?? 't4g.small' })
}
🤖 Prompt for AI Agents
In
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
around lines 61 to 68, the onSubmit branch currently calls
console.error('Project is required'); replace that with user-facing error
handling: call toast.error('Project is required') (so the user sees feedback)
and return early; optionally keep a console.error or sentry.captureMessage for
telemetry if you want dev visibility, but do not leave console.error as the only
notification.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (1)

150-199: Consider extracting refetch interval check to descriptive variable.

The condition refetchInterval === false is repeated three times. Per coding guidelines, extracting this to a descriptive boolean variable would improve readability.

💡 Suggested refactor

Add at the beginning of the component (after line 37):

   maxNumberOfReplicas,
 } = useCheckEligibilityDeployReplica()

+const isWaitingToEnableBackups = refetchInterval === false
+
 const { data: projectDetail, isSuccess: isProjectDetailSuccess } = useProjectDetailQuery(

Then use throughout the block:

     type="warning"
     title={
-      refetchInterval === false
+      isWaitingToEnableBackups
         ? 'Physical backups are required to deploy replicas'
         : 'Physical backups are currently being enabled'
     }
   >
-    {refetchInterval === false ? (
+    {isWaitingToEnableBackups ? (
       <>
         <p>
           Physical backups are used under the hood to spin up read replicas for your project.
...
-    {refetchInterval === false && (
+    {isWaitingToEnableBackups && (
       <div className="flex items-center gap-x-2 mt-2">

As per coding guidelines, use consistent naming conventions for boolean variables with is prefix for state/identity checks.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b04e6b2 and 36abdb1.

📒 Files selected for processing (2)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (1 hunks)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/index.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g., as any, as Type); instead validate values at runtime using zod schemas

Files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
apps/studio/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: use on prefix for prop callbacks and handle prefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers

Files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
🧠 Learnings (7)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Admonition component to alert users of important actions or restrictions

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : When doing a mutation, always use the mutate function with onSuccess and onError callbacks that include toast.success and toast.error

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use mutateAsync only if the mutation is part of multiple async actions, wrapping the call with try/catch block and adding toast.success and toast.error

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-11T16:46:03.692Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/e2e-testing.mdc:0-0
Timestamp: 2025-12-11T16:46:03.692Z
Learning: Applies to e2e/studio/**/*.{ts,spec.ts} : Dismiss toasts before interacting with UI elements as they can overlay buttons and block interactions

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/**/*.{ts,tsx} : Use _Shadcn_ suffixed components (e.g., Input_Shadcn_, Button_Shadcn_) from the ui package where possible

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : When submit button is outside the form, add a formId variable outside the component, set it as id on form element and form prop on the button

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx
🧬 Code graph analysis (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaEligibilityWarnings.tsx (8)
apps/studio/hooks/misc/useSelectedOrganization.ts (1)
  • useSelectedOrganizationQuery (5-21)
apps/studio/hooks/misc/useSelectedProject.ts (1)
  • useSelectedProjectQuery (5-17)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useCheckEligibilityDeployReplica.ts (1)
  • useCheckEligibilityDeployReplica (14-83)
apps/studio/data/projects/project-detail-query.ts (1)
  • useProjectDetailQuery (42-66)
packages/ui-patterns/src/admonition.tsx (1)
  • Admonition (83-180)
apps/studio/lib/constants/index.ts (1)
  • DOCS_URL (48-48)
apps/studio/components/interfaces/Support/SupportLink.tsx (1)
  • SupportLink (7-28)
apps/studio/components/ui/UpgradePlanButton.tsx (1)
  • UpgradePlanButton (34-117)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test
  • GitHub Check: test (1)
  • GitHub Check: typecheck

@github-actions

github-actions Bot commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  67 passed
skipped  4 skipped

Details

stats  71 tests across 12 suites
duration  6 minutes, 37 seconds
commit  2d8dcb5

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@charislam charislam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally as described!

  • Saw admonition for compute size too small
  • Saw admonition for no physical backups
  • Successfully created read replica

Comment on lines +32 to +33
<DialogTrigger>
<p className={cn(InlineLinkClassName, 'text-sm text-foreground-light cursor-pointer')}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<DialogTrigger>
<p className={cn(InlineLinkClassName, 'text-sm text-foreground-light cursor-pointer')}>
<DialogTrigger asChild>
<button className={cn(InlineLinkClassName, 'text-sm text-foreground-light cursor-pointer')}>

might have to tweak styling, but this will give better a11y semantics

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1)

32-36: Consider adding cursor-pointer to button className.

A past review comment suggested including cursor-pointer for better UX consistency. While buttons typically have pointer cursor by default, explicitly adding the class ensures consistent styling across the application.

🔎 Suggested addition
-        <button className={cn(InlineLinkClassName, 'text-sm text-foreground-light')}>
+        <button className={cn(InlineLinkClassName, 'text-sm text-foreground-light cursor-pointer')}>
🧹 Nitpick comments (2)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (2)

24-28: Consider handling loading and error states from queries.

Per coding guidelines, components should handle loading state first with early returns, then error state. While the Dialog is user-triggered and data may already be loaded, adding guards would prevent showing incomplete data if queries are still loading or have failed.

🔎 Suggested pattern
 export const ReadReplicaPricingDialog = () => {
-  const { data: project } = useSelectedProjectQuery()
+  const { data: project, isLoading: isProjectLoading } = useSelectedProjectQuery()
   const { compute, disk, iops, throughput } = useGetReplicaCost()
 
   const showNewDiskManagementUI = project?.cloud_provider === 'AWS'
+
+  // Optionally guard against missing data
+  const hasRequiredData = project && compute && disk && iops && throughput

Then conditionally disable or show loading state in the DialogContent if needed.


46-94: Optional: Consider extracting the AWS pricing table into a separate component.

The AWS-specific pricing table (lines 46-94) could be extracted into a separate component like AwsReplicaPricingTable. This would improve modularity and make the main component easier to scan, though the current size (~90 lines) is well within acceptable limits.

Example structure
// Separate file or within same file
const AwsReplicaPricingTable = ({ compute, disk, iops, throughput }: { 
  compute: ReturnType<typeof useGetReplicaCost>['compute']
  disk: ReturnType<typeof useGetReplicaCost>['disk']
  iops: ReturnType<typeof useGetReplicaCost>['iops']
  throughput: ReturnType<typeof useGetReplicaCost>['throughput']
}) => {
  return (
    <>
      <p className="text-foreground-light text-sm mb-2">...</p>
      <Table>...</Table>
    </>
  )
}

Then use: <AwsReplicaPricingTable compute={compute} disk={disk} iops={iops} throughput={throughput} />

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36abdb1 and 2d8dcb5.

📒 Files selected for processing (1)
  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g., as any, as Type); instead validate values at runtime using zod schemas

Files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
apps/studio/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: use on prefix for prop callbacks and handle prefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers

Files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Calendar inside Popover_Shadcn_ with a trigger button for date picker form fields

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.

Applied to files:

  • apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx
🧬 Code graph analysis (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (6)
apps/studio/hooks/misc/useSelectedProject.ts (1)
  • useSelectedProjectQuery (5-17)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/useGetReplicaCost.ts (1)
  • useGetReplicaCost (14-79)
packages/ui/src/components/shadcn/ui/dialog.tsx (8)
  • Dialog (223-223)
  • DialogTrigger (232-232)
  • DialogContent (225-225)
  • DialogHeader (228-228)
  • DialogTitle (231-231)
  • DialogSectionSeparator (230-230)
  • DialogSection (229-229)
  • DialogFooter (227-227)
blocks/vue/registry/default/lib/utils.ts (1)
  • cn (5-7)
apps/studio/components/ui/InlineLink.tsx (1)
  • InlineLinkClassName (14-15)
apps/studio/lib/constants/index.ts (1)
  • DOCS_URL (48-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test (1)
  • GitHub Check: test
  • GitHub Check: typecheck
🔇 Additional comments (1)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/ReadReplicaForm/ReadReplicaPricingDialog.tsx (1)

39-39: Verify the intent of aria-describedby={undefined}.

Explicitly setting aria-describedby to undefined is uncommon. This may be intentional to suppress Dialog's default behavior when no description section exists, but please confirm this is the desired accessibility pattern.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 68.053%. first build
when pulling 2d8dcb5 on joshen/fe-2285-shift-read-replicas-into-database-replication-section
into cbeb091 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants