Skip to content

Commit

Permalink
Don't use sdk.tables.getTables (as it fails randomly)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrinr committed Sep 3, 2024
1 parent e61b619 commit e364bf5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/server/src/sdk/app/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,18 @@ export function syncSchema(
}

export async function renameLinkedViews(table: Table, renaming: RenameColumn) {
const relatedTableIds = new Set<string>()
const relatedTables: Record<string, Table> = {}

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
Expand Down

0 comments on commit e364bf5

Please sign in to comment.