Fix nullish values in RecordSelector

This commit is contained in:
Andrew Kingston 2020-09-17 13:44:18 +01:00
parent a5a7ba68e3
commit f1696e08ea
1 changed files with 4 additions and 1 deletions

View File

@ -3,10 +3,13 @@
import { Input, Select, Label } from "@budibase/bbui" import { Input, Select, Label } from "@budibase/bbui"
export let value export let value
$: value = value || {}
$: model = $backendUiStore.models.find(model => model._id === value?.modelId) $: model = $backendUiStore.models.find(model => model._id === value?.modelId)
$: schemaFields = Object.entries(model?.schema ?? {}) $: schemaFields = Object.entries(model?.schema ?? {})
// Ensure any nullish modelId values get set to empty string so
// that the select works
$: if (value?.modelId == null) value = { modelId: "" }
function setParsedValue(evt, field) { function setParsedValue(evt, field) {
const fieldSchema = model?.schema[field] const fieldSchema = model?.schema[field]
if (fieldSchema) { if (fieldSchema) {