Try to match primary key or take first

This commit is contained in:
Mel O'Hagan 2023-01-13 11:47:09 +00:00
parent 5477cf420a
commit 66c13a2a77
1 changed files with 4 additions and 1 deletions

View File

@ -127,7 +127,10 @@
let fromPrimary let fromPrimary
$: { $: {
if (!fromPrimary && fromTable) { if (!fromPrimary && fromTable) {
fromPrimary = fromTable.primary[0] const relationshipKey = fromRelationship?.fieldName
fromPrimary =
fromTable.primary.filter(val => val === relationshipKey)[0] ||
fromTable.primary[0]
} }
} }
$: isManyToMany = $: isManyToMany =