From aa0ec1c7cbc6d5395b6db9fd49082c7e1974d67f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 2 Oct 2023 15:12:35 +0200 Subject: [PATCH] Fix validating on relationshipType change --- .../backend/Datasources/CreateEditRelationship.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte index 9c98bdc2e5..aa07fb630c 100644 --- a/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte +++ b/packages/builder/src/components/backend/Datasources/CreateEditRelationship.svelte @@ -57,7 +57,8 @@ label: table.name, value: table._id, })) - $: valid = getErrorCount(errors) === 0 && allRequiredAttributesSet() + $: valid = + getErrorCount(errors) === 0 && allRequiredAttributesSet(relationshipType) $: isManyToMany = relationshipType === RelationshipType.MANY_TO_MANY $: isManyToOne = relationshipType === RelationshipType.MANY_TO_ONE @@ -114,7 +115,7 @@ return Object.entries(errors).filter(entry => !!entry[1]).length } - function allRequiredAttributesSet() { + function allRequiredAttributesSet(relationshipType) { const base = getTable(fromId) && getTable(toId) && fromColumn && toColumn if (relationshipType === RelationshipType.MANY_TO_ONE) { return base && fromPrimary && fromForeign