Fix flakiness

This commit is contained in:
Adria Navarro 2024-10-28 14:28:53 +01:00
parent 641ceea92e
commit d36b810efc
1 changed files with 7 additions and 3 deletions

View File

@ -54,12 +54,13 @@ import { makeExternalQuery } from "../../../integrations/base/query"
import { dataFilters, helpers } from "@budibase/shared-core" import { dataFilters, helpers } from "@budibase/shared-core"
import { isRelationshipColumn } from "../../../db/utils" import { isRelationshipColumn } from "../../../db/utils"
export interface ManyRelationship { interface ManyRelationship {
tableId?: string tableId?: string
id?: string id?: string
isUpdate?: boolean isUpdate?: boolean
key: string key: string
[key: string]: any [key: string]: any
relationshipType: RelationshipType
} }
export interface RunConfig { export interface RunConfig {
@ -386,6 +387,7 @@ export class ExternalRequest<T extends Operation> {
[otherKey]: breakRowIdField(relationship)[0], [otherKey]: breakRowIdField(relationship)[0],
// leave the ID for enrichment later // leave the ID for enrichment later
[thisKey]: `{{ literal ${tablePrimary} }}`, [thisKey]: `{{ literal ${tablePrimary} }}`,
relationshipType: RelationshipType.MANY_TO_MANY,
}) })
} }
} }
@ -402,6 +404,7 @@ export class ExternalRequest<T extends Operation> {
[thisKey]: breakRowIdField(relationship)[0], [thisKey]: breakRowIdField(relationship)[0],
// leave the ID for enrichment later // leave the ID for enrichment later
[otherKey]: `{{ literal ${tablePrimary} }}`, [otherKey]: `{{ literal ${tablePrimary} }}`,
relationshipType: RelationshipType.MANY_TO_ONE,
}) })
} }
} }
@ -531,7 +534,8 @@ export class ExternalRequest<T extends Operation> {
const promises = [] const promises = []
const related = await this.lookupRelations(mainTableId, row) const related = await this.lookupRelations(mainTableId, row)
for (let relationship of relationships) { for (let relationship of relationships) {
const { key, tableId, isUpdate, id, ...rest } = relationship const { key, tableId, isUpdate, id, relationshipType, ...rest } =
relationship
const body: { [key: string]: any } = processObjectSync(rest, row, {}) const body: { [key: string]: any } = processObjectSync(rest, row, {})
const linkTable = this.getTable(tableId) const linkTable = this.getTable(tableId)
const relationshipPrimary = linkTable?.primary || [] const relationshipPrimary = linkTable?.primary || []
@ -545,7 +549,7 @@ export class ExternalRequest<T extends Operation> {
const rows = const rows =
related[ related[
this.getLookupRelationsKey({ this.getLookupRelationsKey({
relationshipType: RelationshipType.MANY_TO_MANY, relationshipType,
fieldName: key, fieldName: key,
through: relationship.tableId, through: relationship.tableId,
}) })