From 4cbbafe9ec4bf2b0901f2a263d1f69ea6dec67c4 Mon Sep 17 00:00:00 2001 From: Jordi Enric Date: Mon, 24 Aug 2026 09:43:07 +0200 Subject: [PATCH] fix(studio): use AVAILABLE_REPLICA_REGIONS for primary region node All AWS_REGIONS keys now have coordinates, so the duplicated Object.keys(AWS_REGIONS) mapping in generateNodes is redundant. --- .../InstanceConfiguration.utils.ts | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts index 81e89e5ae2b..722bde967c1 100644 --- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts +++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts @@ -1,11 +1,9 @@ import dagre from '@dagrejs/dagre' import { Edge, Node, Position } from '@xyflow/react' import { groupBy } from 'lodash' -import { AWS_REGIONS, AWS_REGIONS_KEYS } from 'shared-data' import { AVAILABLE_REPLICA_REGIONS, - AWS_REGIONS_COORDINATES, NODE_HEIGHT_FALLBACKS, NODE_SEP, NODE_WIDTH, @@ -47,26 +45,9 @@ export const generateNodes = ({ } : undefined - // [Joshen] We should be finding from AVAILABLE_REPLICA_REGIONS instead - // but because the new regions (zurich, stockholm, ohio, paris) dont have - // coordinates yet in AWS_REGIONS_COORDINATES - we'll need to add them in once - // they are ready to spin up coordinates for - const primaryRegion = Object.keys(AWS_REGIONS) - .map((key) => { - return { - key: key as AWS_REGIONS_KEYS, - name: AWS_REGIONS?.[key as AWS_REGIONS_KEYS].displayName, - region: AWS_REGIONS?.[key as AWS_REGIONS_KEYS].code, - coordinates: AWS_REGIONS_COORDINATES[key], - } - }) - .find((region) => primary.region.includes(region.region)) - - // [Joshen] Once we have the coordinates for Zurich and Stockholm, we can remove the above - // and uncomment below for better simplicity - // const primaryRegion = AVAILABLE_REPLICA_REGIONS.find((region) => - // primary.region.includes(region.region) - // ) + const primaryRegion = AVAILABLE_REPLICA_REGIONS.find((region) => + primary.region.includes(region.region) + ) const primaryNode: Node = { position,