From e364bf5d6526cce85185e33bfea4d597d1bc65cd Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 3 Sep 2024 11:00:15 +0200 Subject: [PATCH] Don't use `sdk.tables.getTables` (as it fails randomly) --- packages/server/src/sdk/app/views/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index b90c308ead8..07a09cb0257 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -254,21 +254,18 @@ export function syncSchema( } export async function renameLinkedViews(table: Table, renaming: RenameColumn) { - const relatedTableIds = new Set() + const relatedTables: Record = {} for (const field of Object.values(table.schema)) { if (field.type !== FieldType.LINK) { continue } - relatedTableIds.add(field.tableId) + relatedTables[field.tableId] ??= await sdk.tables.getTable(field.tableId) break } - const relatedTables = await sdk.tables.getTables( - Array.from(relatedTableIds.values()) - ) - for (const relatedTable of relatedTables) { + for (const relatedTable of Object.values(relatedTables)) { let toSave = false const viewsV2 = Object.values(relatedTable.views || {}).filter( sdk.views.isV2