Repository navigation
Joshen/fe 2300 alpha notices for replication all needs to be shifted into - #41765
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
WalkthroughAdds replication readiness wiring to DestinationPanel, conditionally rendering an EnableReplicationCallout when replication isn’t enabled, displays Alpha badges for certain destination types, refactors Destinations into a Card/Table with ReadReplica rows, and extends component props to support callbacks and children. Changes
Sequence DiagramsequenceDiagram
participant User as User/UI
participant DP as DestinationPanel
participant OrgQ as useSelectedOrganizationQuery
participant SrcQ as useReplicationSourcesQuery
participant Callout as EnableReplicationCallout
User->>DP: mount
DP->>DP: read route params (projectRef)
DP->>OrgQ: fetch org / plan status
OrgQ-->>DP: isPaidPlan
DP->>SrcQ: fetch replication sources (projectRef)
SrcQ-->>DP: sources + status
rect rgb(247, 250, 255)
Note over DP: compute replicationNotEnabled = (sources fetched && no matching source)
end
alt replicationNotEnabled && unifiedReplicationEnabled
DP->>Callout: render EnableReplicationCallout
Callout->>OrgQ: use plan status
alt paid plan
Callout->>Callout: render EnableReplicationModal
else unpaid plan
Callout->>Callout: render UpgradePlanButton
end
else replication enabled or read-replica selected
DP->>DP: render DestinationForm or ReadReplicaForm/path
end
Callout-->>User: display enablement UI
DP-->>User: display destination UI
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (2)apps/studio/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
Files:
apps/studio/**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)
Files:
🧠 Learnings (7)📚 Learning: 2025-12-11T17:04:40.037ZApplied to files:
📚 Learning: 2025-12-11T17:04:40.037ZApplied to files:
📚 Learning: 2025-12-11T16:46:18.701ZApplied to files:
📚 Learning: 2025-12-11T17:04:40.037ZApplied to files:
📚 Learning: 2025-12-12T05:20:17.409ZApplied to files:
📚 Learning: 2026-01-02T05:58:55.226ZApplied to files:
📚 Learning: 2025-12-11T17:04:40.037ZApplied to files:
🧬 Code graph analysis (1)apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx (4)
⏰ 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). (1)
🔇 Additional comments (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright Test ResultsDetails
Skipped testsFeatures › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/studio/components/interfaces/Database/Replication/Destinations.tsx (1)
44-45: Remove unused variableisPaidPlan.The
isPaidPlanvariable is derived from the organization query but is never used in this component. The plan-based gating logic is handled internally byEnableReplicationCallout.🧹 Suggested fix
- const { data: organization } = useSelectedOrganizationQuery() - const isPaidPlan = organization?.plan.id !== 'free'
🤖 Fix all issues with AI agents
In
@apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx:
- Around line 44-45: The derived variable isPaidPlan is unused; remove the
isPaidPlan declaration and, if the organization data returned by
useSelectedOrganizationQuery() isn't used elsewhere in DestinationPanel, remove
the entire call to useSelectedOrganizationQuery (and the organization const) so
the component no longer fetches unused org data; keep EnableReplicationCallout
as the source of plan logic.
In
@apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx:
- Around line 92-93: The component currently computes isPaidPlan =
organization?.plan.id !== 'free' which treats undefined organization (loading)
as false and can show the upgrade CTA prematurely; update the logic in
EnableReplicationCallout to handle the loading state from
useSelectedOrganizationQuery (e.g., check isLoading/isFetching or whether
organization is undefined), and either render a loading placeholder or set
isPaidPlan to null/undefined and guard UI (disable/hide the upgrade button or
return early) until organization is resolved; reference
useSelectedOrganizationQuery, organization, and isPaidPlan when making the
change.
🧹 Nitpick comments (1)
apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx (1)
39-42: Ensure early return after guard clause.The
console.erroris followed by implicit undefined return, which is correct behavior but could be more explicit. The current pattern works but addingreturnmakes the intent clearer.♻️ Optional clarification
const onEnableReplication = async () => { - if (!projectRef) return console.error('Project ref is required') + if (!projectRef) { + console.error('Project ref is required') + return + } createTenantSource({ projectRef }) }
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/Destinations.tsxapps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsxapps/studio/components/ui/AlphaNotice.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:isprefix for state/identity,hasprefix for possession,canprefix for capability/permission,shouldprefix 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/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsxapps/studio/components/ui/AlphaNotice.tsxapps/studio/components/interfaces/Database/Replication/Destinations.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: useonprefix for prop callbacks andhandleprefix 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/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsxapps/studio/components/ui/AlphaNotice.tsxapps/studio/components/interfaces/Database/Replication/Destinations.tsx
🧠 Learnings (10)
📚 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 RadioGroupStacked with RadioGroupStackedItem for stacked radio options with descriptions
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.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/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsxapps/studio/components/ui/AlphaNotice.tsxapps/studio/components/interfaces/Database/Replication/Destinations.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsxapps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsxapps/studio/components/ui/AlphaNotice.tsxapps/studio/components/interfaces/Database/Replication/Destinations.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 : Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Applied to files:
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsxapps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.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
📚 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/EnableReplicationCallout.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/EnableReplicationCallout.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/EnableReplicationCallout.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/ui/AlphaNotice.tsx
📚 Learning: 2025-12-11T00:21:05.527Z
Learnt from: dnywh
Repo: supabase/supabase PR: 41215
File: apps/design-system/content/docs/accessibility.mdx:30-30
Timestamp: 2025-12-11T00:21:05.527Z
Learning: In apps/design-system/content/docs/, MDX files use different relative path formats based on their location: root-level docs use `components/button` format, while subdirectory docs (ui-patterns/, components/) use `../components/button` format for linking to components.
Applied to files:
apps/studio/components/ui/AlphaNotice.tsx
🧬 Code graph analysis (2)
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (4)
apps/studio/hooks/misc/useSelectedOrganization.ts (1)
useSelectedOrganizationQuery(5-21)apps/studio/data/replication/sources-query.ts (1)
useReplicationSourcesQuery(29-44)packages/ui/src/components/shadcn/ui/sheet.tsx (1)
SheetSection(237-237)apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx (1)
EnableReplicationCallout(85-114)
apps/studio/components/interfaces/Database/Replication/Destinations.tsx (1)
apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx (1)
EnableReplicationCallout(85-114)
⏰ 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 (6)
apps/studio/components/ui/AlphaNotice.tsx (1)
15-20: LGTM!The addition of
childrensupport viaPropsWithChildren<AlphaNoticeProps>is a clean and idiomatic approach for extending the component's content. The placement after the description paragraph allows for flexible additional content insertion.Also applies to: 64-64
apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationTypeSelection.tsx (1)
69-72: LGTM!The Alpha badge conditional rendering is correctly implemented. The pattern
{unifiedReplication && <Badge>Alpha</Badge>}follows the coding guidelines for simple show/hide conditional rendering.Also applies to: 91-94
apps/studio/components/interfaces/Database/Replication/Destinations.tsx (1)
218-219: LGTM!The conditional rendering correctly gates the
EnableReplicationCalloutto display only when unified replication is disabled and replication is not yet enabled. This aligns with the PR objective of moving the CTA into the Destination Panel when the feature flag is on.apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx (1)
24-83: LGTM on the modal implementation.The
EnableReplicationModalcorrectly uses the mutation pattern withonSuccessandonErrorcallbacks includingtoast.successandtoast.error, following the established patterns from learnings.apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanel.tsx (2)
87-100: LGTM on the conditional flow.The rendering logic correctly implements the feature flag behavior:
- Read Replica →
ReadReplicaForm- Unified replication enabled but replication not set up →
EnableReplicationCallout- Otherwise →
DestinationFormThis aligns with the PR objective of shifting the enable-replication CTA into the Destination Panel when the unified replication flag is on.
55-59: Consider handling loading state for sources query.When sources are still loading,
replicationNotEnabledisfalse, causingDestinationFormto render. If the user doesn't have replication enabled, there may be a brief flash when the form switches to the callout after loading completes.This is acceptable behavior but worth noting. If smoother UX is desired, consider showing a skeleton loader while
isSourcesLoading.
awaseem
left a comment
There was a problem hiding this comment.
Minor code rabbit changes need to be done
Braintrust eval report
|
Context
Part of unifying replication UI - shifts the CTA to enable replication into the Destination Panel if the feature flag is on, as enabling replication only applies for creating destinations to BigQuery and Analytics Buckets
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.