{#if fieldState}
-
-
-
+ fieldApi.setValue(e.detail)}
+ {text} />
{/if}
-
-
diff --git a/packages/standard-components/src/forms/RelationshipField.svelte b/packages/standard-components/src/forms/RelationshipField.svelte
index 3e7ef7b0e6..85643be227 100644
--- a/packages/standard-components/src/forms/RelationshipField.svelte
+++ b/packages/standard-components/src/forms/RelationshipField.svelte
@@ -21,6 +21,8 @@
$: linkedTableId = fieldSchema?.tableId
$: fetchRows(linkedTableId)
$: fetchTable(linkedTableId)
+ $: singleValue = flatten($fieldState?.value)?.[0]
+ $: multiValue = flatten($fieldState?.value) ?? []
const fetchTable = async id => {
if (id) {
@@ -38,6 +40,13 @@
}
}
+ const flatten = values => {
+ if (!values) {
+ return []
+ }
+ return values.map(value => (typeof value === "object" ? value._id : value))
+ }
+
const getDisplayName = row => {
return row?.[tableDefinition?.primaryDisplay || "_id"] || "-"
}
@@ -64,7 +73,7 @@