Skip to content

Joshen/fe 2287 summary nodegraph in replication page - #42042

Merged
joshenlim merged 12 commits into
masterfrom
joshen/fe-2287-summary-nodegraph-in-replication-page
Jan 23, 2026
Merged

joshenlim merged 12 commits into
masterfrom
joshen/fe-2287-summary-nodegraph-in-replication-page

Conversation

@joshenlim

@joshenlim joshenlim commented Jan 21, 2026 •

Copy link
Copy Markdown
Member

Context

Related to unifying read replicas into database/replication - adds a read-only summary node graph to the top of the page

  • Each replica / destination will be it's own node
    • Opting to show all nodes for now, we can consider further down whether we want to consolidate nodes (e.g "+ 4 more targets" or something to prevent rendering too many nodes although I don't think that'll be a problem for now)
  • The animated edges are meant to be indicative of an active replication
    • e.g if the replica status is not "active", the edge will be a static dashed line with a slightly lower opacity
demo.mp4

Summary by CodeRabbit

  • New Features

    • Added a visual, read-only replication topology diagram showing primary, read replicas, and destinations with status indicators, region labels, and connection handles.
  • Improvements

    • Integrated the diagram into the replication page as a full-width section and refreshed layout/spacing for clearer organization.
    • More efficient, data-driven status refreshing that stops when replicas are stable to reduce unnecessary updates.

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

@vercel

vercel Bot commented Jan 21, 2026 •

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 Jan 23, 2026 8:22am
studio-staging Ready Ready Preview, Comment Jan 23, 2026 8:22am
6 Skipped Deployments
Project Deployment Review Updated (UTC)
cms Ignored Ignored Jan 23, 2026 8:22am
studio Ignored Ignored Jan 23, 2026 8:22am
design-system Skipped Skipped Jan 23, 2026 8:22am
docs Skipped Skipped Jan 23, 2026 8:22am
ui-library Skipped Skipped Jan 23, 2026 8:22am
zone-www-dot-com Skipped Skipped Jan 23, 2026 8:22am

Request Review

@supabase

supabase Bot commented Jan 21, 2026

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 Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a read-only replication topology diagram with new node components and Dagre-based layout; integrates the diagram into the replication page; changes useReadReplicasQuery to accept query options; removes the separate replica-status query and replicaStatus prop usage; exports a replication pipeline response type.

Changes

Cohort / File(s) Summary
ReplicationDiagram components
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/Nodes.tsx, apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx, apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/ReplicationDiagram.utils.ts
Adds NODE_WIDTH, node components (PrimaryDatabaseNode, ReplicationNode, ReadReplicaNode), getDagreGraphLayout (Dagre layout), and ReplicationDiagram which builds, layouts, and renders a read-only ReactFlow topology using multiple queries and status-driven styling.
Page integration / layout
apps/studio/pages/project/[ref]/database/replication/index.tsx
Renders ReplicationDiagram on the replication page; converts sections to full-width layout, repositions the diagram and Destinations, adjusts spacing and fallback view.
Destinations & ReadReplicas updates
apps/studio/components/interfaces/Database/Replication/Destinations.tsx, apps/studio/components/interfaces/Database/Replication/ReadReplicas/ReadReplicaRow.tsx
Removes useReadReplicasStatusesQuery and ReplicaInitializationStatus usage; useReadReplicasQuery now accepts a second options arg (e.g., { refetchInterval }); polling logic revised to use readReplicas data; ReadReplicaRow no longer receives replicaStatus prop and derives status from replica.
Type export
apps/studio/data/replication/pipeline-status-query.ts
ReplicationPipelineStatusResponse changed to an exported type for cross-module visibility.
Import reorder (no behavior change)
apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts
Reordered AWS_REGIONS / AWS_REGIONS_KEYS imports; no runtime behavior change.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Page as Replication Page
    participant RDC as ReplicationDiagramContent
    participant RRQ as ReadReplicasQuery
    participant DQ as DestinationsQuery
    participant PQ as PipelinesQuery
    participant PSQ as PipelineStatusQuery
    participant Dagre as Dagre(layout)
    participant RF as ReactFlow

    User->>Page: open replication page
    Page->>RDC: mount ReplicationDiagramContent
    RDC->>RRQ: fetch read replicas
    RRQ-->>RDC: replicas data
    RDC->>DQ: fetch destinations
    DQ-->>RDC: destinations data
    RDC->>PQ: fetch pipelines for destinations
    PQ-->>RDC: pipelines data
    RDC->>PSQ: poll pipeline statuses
    PSQ-->>RDC: pipeline status data
    RDC->>RDC: build nodes & edges (status-driven)
    RDC->>Dagre: layout nodes & edges
    Dagre-->>RDC: positioned nodes/edges
    RDC->>RF: configure & render diagram
    RF-->>User: display topology
Loading

Possibly related PRs

Suggested reviewers

  • alaister
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description does not follow the required template; it is missing required sections like 'I have read CONTRIBUTING.md', 'Kind of change', 'Current behavior', and 'New behavior' structure. Restructure the description to follow the template: confirm CONTRIBUTING.md review, specify change type (feature), reference related issues, describe the new behavior with context, and include relevant details about the node graph implementation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change—adding a summary node graph to the replication page—which aligns with the primary objective of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

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

@joshenlim
joshenlim marked this pull request as ready for review January 21, 2026 17:27
@joshenlim
joshenlim requested a review from a team as a code owner January 21, 2026 17:27
} = useReadReplicasQuery({
projectRef,
})
} = useReadReplicasQuery({ projectRef }, { refetchInterval: statusRefetchInterval })

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

JFYI i think i can simplify the long polling logic here to not depend on the replica status query actually

will look into this separately

@coveralls

coveralls commented Jan 21, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 66.134% (+0.02%) from 66.113%
when pulling e5f4167 on joshen/fe-2287-summary-nodegraph-in-replication-page
into b55c399 on master.

@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: 1

🤖 Fix all issues with AI agents
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx`:
- Around line 75-81: The map callback in destinations.map uses a parameter named
x that shadows the outer destination variable, causing the find to compare
pipeline.destination_id === pipeline.id; fix by renaming the inner find
parameter (e.g., to p or pipelineCandidate) and compare p.destination_id ===
x.id (or rename the outer map param to destination and compare p.destination_id
=== destination.id) when searching pipelinesData?.pipelines, keeping the rest of
the logic (pipelineStatus via replicationKeys.pipelinesStatus, getStatusName,
isReplicating) unchanged.
🧹 Nitpick comments (6)
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/ReplicationDiagram.utils.ts (1)

29-41: Minor: Unnecessary return inside forEach callback.

The return node statement on line 40 has no effect since forEach ignores return values. This appears to be a leftover from a potential map implementation.

♻️ Suggested fix
   nodes.forEach((node) => {
     const nodeWithPosition = dagreGraph.node(node.id)
     node.sourcePosition = Position.Right
     node.targetPosition = Position.Left
     // We are shifting the dagre node position (anchor=center center) to the top left
     // so it matches the React Flow node anchor point (top left).
     node.position = {
       x: nodeWithPosition.x - nodeWithPosition.width / 2,
       y: nodeWithPosition.y - nodeWithPosition.height / 2,
     }
-
-    return node
   })
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx (3)

77-79: Avoid type casting; consider runtime validation or narrowing.

The as ReplicationPipelineStatusResponse cast bypasses type safety. Per coding guidelines, prefer runtime validation. Since getQueryData can return undefined and the type may not match at runtime, consider handling this more defensively.

♻️ Suggested approach
-      const pipelineStatus = queryClient.getQueryData(
-        replicationKeys.pipelinesStatus(projectRef, pipeline?.id)
-      ) as ReplicationPipelineStatusResponse
+      const pipelineStatus = queryClient.getQueryData<ReplicationPipelineStatusResponse>(
+        replicationKeys.pipelinesStatus(projectRef, pipeline?.id)
+      )

Using the generic parameter on getQueryData is the idiomatic approach and avoids explicit casting.


120-122: Potential excessive re-renders due to unstable dependency.

The nodes array is recreated on every render, causing this useEffect to run repeatedly. Consider memoizing the nodes/edges arrays or using a stable dependency like the count or IDs.

♻️ Suggested approach
+  const nodeCount = 1 + readReplicas.length + destinations.length
+
   useEffect(() => {
-    if (nodes.length > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
-  }, [nodes, isSuccessDestinations, isSuccessReplicas])
+    if (nodeCount > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+  }, [nodeCount, isSuccessDestinations, isSuccessReplicas])

Alternatively, memoize the nodes and edges arrays with useMemo so they have stable references when the underlying data hasn't changed.


110-118: Consider memoizing setReactFlow with useCallback.

The setReactFlow function is recreated on every render. While not critical for correctness, memoizing it would provide a stable reference and is a best practice when the function is used in effects or passed to children.

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

70-70: Define explicit prop interfaces for components.

Per coding guidelines, React components should have explicitly defined prop interfaces. Both ReplicationNode and ReadReplicaNode accept an id prop that should be typed via an interface.

♻️ Suggested approach
interface ReplicationNodeProps {
  id: string
}

export const ReplicationNode = ({ id }: ReplicationNodeProps) => {
  // ...
}

interface ReadReplicaNodeProps {
  id: string
}

export const ReadReplicaNode = ({ id }: ReadReplicaNodeProps) => {
  // ...
}

As per coding guidelines for apps/studio/**/*.tsx.

Also applies to: 129-129


21-33: Consider documenting or extracting the magic number.

The width calculation NODE_WIDTH / 2 + 55 uses a magic number 55. Consider extracting this as a named constant or adding a brief comment explaining its purpose (e.g., padding/margin compensation).

@github-actions

github-actions Bot commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  83 passed
flaky  1 flaky
skipped  4 skipped

Details

stats  88 tests across 14 suites
duration  11 minutes, 8 seconds
commit  e5f4167

Flaky tests

Features › table-editor.spec.ts › table editor › add enums and show enums on table

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

@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: 1

🤖 Fix all issues with AI agents
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx`:
- Around line 43-96: The nodes and edges arrays are recreated each render
causing the useEffect that depends on nodes to retrigger; wrap the nodes and
edges construction in useMemo to memoize them and list correct dependencies
(e.g., projectRef, readReplicas, destinations, pipelinesData?.pipelines,
queryClient, and anything used to compute pipeline/status like replicationKeys
or getStatusName) so references are stable between renders; also simplify the
edge property animated: isReplicating ? true : false to animated: isReplicating.
🧹 Nitpick comments (3)
apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx (3)

77-79: Consider using the generic type parameter instead of type assertion.

Per coding guidelines, avoid type casting with as. The getQueryData method accepts a generic type parameter which provides better type safety.

♻️ Proposed fix
-      const pipelineStatus = queryClient.getQueryData(
+      const pipelineStatus = queryClient.getQueryData<ReplicationPipelineStatusResponse>(
         replicationKeys.pipelinesStatus(projectRef, pipeline?.id)
-      ) as ReplicationPipelineStatusResponse
+      )

110-118: Wrap setReactFlow in useCallback for referential stability.

If you memoize nodes and edges as suggested, this function should also be wrapped in useCallback to prevent it from being recreated on every render. The timeout workaround is acknowledged in the comment—this is a known ReactFlow quirk.

♻️ Proposed fix
-  const setReactFlow = async () => {
+  const setReactFlow = useCallback(async () => {
     const graph = getDagreGraphLayout(nodes, edges)
     reactFlow.setNodes(graph.nodes)
     reactFlow.setEdges(graph.edges)

     // [Joshen] Odd fix to ensure that react flow snaps back to center when adding nodes
     await timeout(1)
     reactFlow.fitView({ maxZoom: 0.9, minZoom: 0.9 })
-  }
+  }, [nodes, edges, reactFlow])

120-122: Include setReactFlow in the dependency array.

If setReactFlow is wrapped in useCallback, it should be included in the effect's dependency array to satisfy React's exhaustive-deps rule and ensure the effect uses the latest function reference.

♻️ Proposed fix
   useEffect(() => {
     if (nodes.length > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
-  }, [nodes, isSuccessDestinations, isSuccessReplicas])
+  }, [nodes, isSuccessDestinations, isSuccessReplicas, setReactFlow])

@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: 1

🤖 Fix all issues with AI agents
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx`:
- Around line 60-126: The edges useMemo reads pipeline status via
queryClient.getQueryData (replicationKeys.pipelinesStatus) which does not
subscribe to cache updates, so edge animated state can become stale; replace
that non-reactive read by subscribing to pipeline statuses (e.g., useQueries or
the existing useReplicationPipelineStatusQuery per pipeline id) and use those
reactive values when computing edges in the edges useMemo, and also add edges to
the dependency array of the useEffect that calls setReactFlow (currently [nodes,
isSuccessDestinations, isSuccessReplicas]) so the layout is recalculated when
edges change.

Comment on lines +60 to +126
const edges = useMemo(() => {
return [
...readReplicas.map((x) => {
const isReplicating = x.status === 'ACTIVE_HEALTHY'

return {
id: `${projectRef}-${x.identifier}`,
source: projectRef,
target: x.identifier,
type: 'smoothstep',
className: '!cursor-default',
animated: isReplicating,
style: {
opacity: isReplicating ? 1 : 0.4,
strokeDasharray: isReplicating ? undefined : '5 5',
},
}
}),
...destinations.map((x) => {
const pipeline = (pipelinesData?.pipelines ?? []).find((p) => p.destination_id === x.id)
const pipelineStatus = queryClient.getQueryData(
replicationKeys.pipelinesStatus(projectRef, pipeline?.id)
) as ReplicationPipelineStatusResponse
const statusName = getStatusName(pipelineStatus?.status)
const isReplicating = statusName === 'started'

return {
id: `${projectRef}-${x.id}`,
source: projectRef,
target: x.id.toString(),
type: 'smoothstep',
className: '!cursor-default',
animated: isReplicating,
style: {
opacity: isReplicating ? 1 : 0.4,
strokeDasharray: isReplicating ? undefined : '5 5',
},
}
}),
]
}, [destinations, pipelinesData?.pipelines, projectRef, queryClient, readReplicas])

const nodeTypes = useMemo(
() => ({
primary: PrimaryDatabaseNode,
replication: ReplicationNode,
readReplica: ReadReplicaNode,
}),
[]
)

const backgroundPatternColor =
resolvedTheme === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.4)'

const setReactFlow = async () => {
const graph = getDagreGraphLayout(nodes, edges)
reactFlow.setNodes(graph.nodes)
reactFlow.setEdges(graph.edges)

// [Joshen] Odd fix to ensure that react flow snaps back to center when adding nodes
await timeout(1)
reactFlow.fitView({ maxZoom: 0.9, minZoom: 0.9 })
}

useEffect(() => {
if (nodes.length > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
}, [nodes, isSuccessDestinations, isSuccessReplicas])

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 | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find apps/studio -name "ReplicationDiagram" -o -path "*Replication*" -type f | head -20

Repository: supabase/supabase

Length of output: 2171


🏁 Script executed:

fd -t f "index.tsx" | grep -i replication | grep -i diagram

Repository: supabase/supabase

Length of output: 144


🏁 Script executed:

git ls-files | grep -i "ReplicationDiagram"

Repository: supabase/supabase

Length of output: 330


🏁 Script executed:

cat -n apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx

Repository: supabase/supabase

Length of output: 6104


🏁 Script executed:

grep -r "pipelinesStatus" apps/studio/components/interfaces/Database/Replication/ --include="*.ts" --include="*.tsx" -n

Repository: supabase/supabase

Length of output: 215


🏁 Script executed:

cat -n apps/studio/data/replication/keys.ts | head -50

Repository: supabase/supabase

Length of output: 1656


🏁 Script executed:

grep -r "useQueries\|pipeline.*status" apps/studio/components/interfaces/Database/Replication/ --include="*.ts" --include="*.tsx" -B 2 -A 2 | head -80

Repository: supabase/supabase

Length of output: 8604


🏁 Script executed:

grep -r "useReplicationPipelineStatusQuery" apps/studio --include="*.ts" --include="*.tsx" -l

Repository: supabase/supabase

Length of output: 677


🏁 Script executed:

cat -n apps/studio/data/replication/pipelines-query.ts

Repository: supabase/supabase

Length of output: 1839


🏁 Script executed:

cat -n apps/studio/data/replication/pipeline-status-query.ts

Repository: supabase/supabase

Length of output: 2170


Edge animations can become stale due to non-reactive pipeline status reads.
Using queryClient.getQueryData(...) reads a cache snapshot without subscribing to updates. When pipeline statuses change in the cache elsewhere (e.g., via polling in other components), this component won't react. Additionally, the useEffect doesn't depend on edges, so even if they recalculate, the layout won't update. The immediate fix is to add edges to the dependency array so layout updates whenever edges change. However, for full reactivity, subscribe to individual pipeline statuses via useQueries (similar to how DestinationRow.tsx uses useReplicationPipelineStatusQuery).

🔧 Minimum fix
  useEffect(() => {
    if (nodes.length > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
-  }, [nodes, isSuccessDestinations, isSuccessReplicas])
+  }, [edges, nodes, isSuccessDestinations, isSuccessReplicas])
📝 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 edges = useMemo(() => {
return [
...readReplicas.map((x) => {
const isReplicating = x.status === 'ACTIVE_HEALTHY'
return {
id: `${projectRef}-${x.identifier}`,
source: projectRef,
target: x.identifier,
type: 'smoothstep',
className: '!cursor-default',
animated: isReplicating,
style: {
opacity: isReplicating ? 1 : 0.4,
strokeDasharray: isReplicating ? undefined : '5 5',
},
}
}),
...destinations.map((x) => {
const pipeline = (pipelinesData?.pipelines ?? []).find((p) => p.destination_id === x.id)
const pipelineStatus = queryClient.getQueryData(
replicationKeys.pipelinesStatus(projectRef, pipeline?.id)
) as ReplicationPipelineStatusResponse
const statusName = getStatusName(pipelineStatus?.status)
const isReplicating = statusName === 'started'
return {
id: `${projectRef}-${x.id}`,
source: projectRef,
target: x.id.toString(),
type: 'smoothstep',
className: '!cursor-default',
animated: isReplicating,
style: {
opacity: isReplicating ? 1 : 0.4,
strokeDasharray: isReplicating ? undefined : '5 5',
},
}
}),
]
}, [destinations, pipelinesData?.pipelines, projectRef, queryClient, readReplicas])
const nodeTypes = useMemo(
() => ({
primary: PrimaryDatabaseNode,
replication: ReplicationNode,
readReplica: ReadReplicaNode,
}),
[]
)
const backgroundPatternColor =
resolvedTheme === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.4)'
const setReactFlow = async () => {
const graph = getDagreGraphLayout(nodes, edges)
reactFlow.setNodes(graph.nodes)
reactFlow.setEdges(graph.edges)
// [Joshen] Odd fix to ensure that react flow snaps back to center when adding nodes
await timeout(1)
reactFlow.fitView({ maxZoom: 0.9, minZoom: 0.9 })
}
useEffect(() => {
if (nodes.length > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
}, [nodes, isSuccessDestinations, isSuccessReplicas])
const edges = useMemo(() => {
return [
...readReplicas.map((x) => {
const isReplicating = x.status === 'ACTIVE_HEALTHY'
return {
id: `${projectRef}-${x.identifier}`,
source: projectRef,
target: x.identifier,
type: 'smoothstep',
className: '!cursor-default',
animated: isReplicating,
style: {
opacity: isReplicating ? 1 : 0.4,
strokeDasharray: isReplicating ? undefined : '5 5',
},
}
}),
...destinations.map((x) => {
const pipeline = (pipelinesData?.pipelines ?? []).find((p) => p.destination_id === x.id)
const pipelineStatus = queryClient.getQueryData(
replicationKeys.pipelinesStatus(projectRef, pipeline?.id)
) as ReplicationPipelineStatusResponse
const statusName = getStatusName(pipelineStatus?.status)
const isReplicating = statusName === 'started'
return {
id: `${projectRef}-${x.id}`,
source: projectRef,
target: x.id.toString(),
type: 'smoothstep',
className: '!cursor-default',
animated: isReplicating,
style: {
opacity: isReplicating ? 1 : 0.4,
strokeDasharray: isReplicating ? undefined : '5 5',
},
}
}),
]
}, [destinations, pipelinesData?.pipelines, projectRef, queryClient, readReplicas])
const nodeTypes = useMemo(
() => ({
primary: PrimaryDatabaseNode,
replication: ReplicationNode,
readReplica: ReadReplicaNode,
}),
[]
)
const backgroundPatternColor =
resolvedTheme === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.4)'
const setReactFlow = async () => {
const graph = getDagreGraphLayout(nodes, edges)
reactFlow.setNodes(graph.nodes)
reactFlow.setEdges(graph.edges)
// [Joshen] Odd fix to ensure that react flow snaps back to center when adding nodes
await timeout(1)
reactFlow.fitView({ maxZoom: 0.9, minZoom: 0.9 })
}
useEffect(() => {
if (nodes.length > 0 && isSuccessDestinations && isSuccessReplicas) setReactFlow()
}, [edges, nodes, isSuccessDestinations, isSuccessReplicas])
🤖 Prompt for AI Agents
In
`@apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/index.tsx`
around lines 60 - 126, The edges useMemo reads pipeline status via
queryClient.getQueryData (replicationKeys.pipelinesStatus) which does not
subscribe to cache updates, so edge animated state can become stale; replace
that non-reactive read by subscribing to pipeline statuses (e.g., useQueries or
the existing useReplicationPipelineStatusQuery per pipeline id) and use those
reactive values when computing edges in the edges useMemo, and also add edges to
the dependency array of the useEffect that calls setReactFlow (currently [nodes,
isSuccessDestinations, isSuccessReplicas]) so the layout is recalculated when
edges change.

@alaister alaister left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

  • Tested on preview

]
}, [destinations, pipelinesData?.pipelines, projectRef, queryClient, readReplicas])

const nodeTypes = useMemo(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very much a nit, but this is static right? So you could just move it outside of the component

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh yup! that's fair

@blacksmith-sh

This comment has been minimized.

@joshenlim
joshenlim merged commit 1536ee1 into master Jan 23, 2026
15 of 16 checks passed
@joshenlim
joshenlim deleted the joshen/fe-2287-summary-nodegraph-in-replication-page branch January 23, 2026 09:59
@github-actions

github-actions Bot commented Jan 23, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1769162940)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 0% (+0pp) - -
Docs Faithfulness 60% (-15pp) - 1 🔴
Goal Completion 87.5% (+0pp) - -
Tool Usage 75% (-12pp) - 1 🔴
Correctness 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Time_to_first_token 0.18tok (-0.06tok) 2 🟢 6 🔴
Llm_calls 8.38 (+0.5) 4 🟢 1 🔴
Tool_calls 3.25 (+0.5) 4 🟢 1 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 113237.5tok (+41506.75tok) 4 🟢 4 🔴
Prompt_cached_tokens 35744tok (-96tok) 2 🟢 5 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 4824tok (-68.5tok) 4 🟢 4 🔴
Completion_reasoning_tokens 3440tok (+240tok) 4 🟢 4 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 118061.5tok (+41438.25tok) 3 🟢 5 🔴
Estimated_cost 0.03$ (+0.01$) 2 🟢 6 🔴
Duration 38.01s (+0.14s) 3 🟢 5 🔴
Llm_duration 75.08s (+0.24s) 3 🟢 5 🔴

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