Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix schema visualizer animations (#45065)

Charis485402640f15
diff --git a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
index 0d470a0cfe9..e6e0e7cda73 100644
--- a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
+++ b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
@@ -175,9 +175,19 @@ export const SchemaGraph = () => {
(params: OnSelectionChangeParams<Node<TableNodeData>, Edge<EdgeData>>) => {
if (params.edges.length === 1) {
setSelectedEdge(params.edges[0])
- return
+ } else {
+ setSelectedEdge(undefined)
}
- setSelectedEdge(undefined)
+
+ const selectedNodeIds = new Set(params.nodes.map((n) => n.id))
+ reactFlowInstance.setEdges(
+ reactFlowInstance.getEdges().map((edge) => ({
+ ...edge,
+ animated:
+ selectedNodeIds.size > 0 &&
+ (selectedNodeIds.has(edge.source) || selectedNodeIds.has(edge.target)),
+ }))
+ )
}
)
@@ -382,7 +392,7 @@ export const SchemaGraph = () => {
defaultEdges={[]}
defaultEdgeOptions={{
type: 'default',
- animated: true,
+ animated: false,
deletable: false,
}}
nodeTypes={nodeTypes}