diff --git a/packages/builder/src/components/common/LinkedRecordSelector.svelte b/packages/builder/src/components/common/LinkedRecordSelector.svelte
index 5bee4eb78f..de0eaba160 100644
--- a/packages/builder/src/components/common/LinkedRecordSelector.svelte
+++ b/packages/builder/src/components/common/LinkedRecordSelector.svelte
@@ -4,31 +4,30 @@
import api from "builderStore/api"
import { Select, Label } from "@budibase/bbui"
import { capitalise } from "../../helpers"
+ import MultiSelect from "components/common/MultiSelect.svelte"
export let schema
export let linkedRecords = []
- let records = []
$: label = capitalise(schema.name)
$: linkedModelId = schema.modelId
$: linkedModel = $backendUiStore.models.find(
model => model._id === linkedModelId
)
+ $: promise = fetchRecords(linkedModelId)
- async function fetchRecords() {
- const FETCH_RECORDS_URL = `/api/${linkedModelId}/records`
+ async function fetchRecords(linkedModelId) {
+ const FETCH_RECORDS_URL = `/api/${}/records`
const response = await api.get(FETCH_RECORDS_URL)
- records = await response.json()
+ const result = await response.json()
+ console.log(result)
+ return result
}
function getPrettyName(record) {
return record[linkedModel.primaryDisplay || "_id"]
}
-
- onMount(() => {
- fetchRecords()
- })
{#if linkedModel.primaryDisplay == null}
@@ -39,10 +38,16 @@
table.
{:else}
-
+ {#await promise then records}
+