diff --git a/packages/builder/src/database/FieldView.svelte b/packages/builder/src/database/FieldView.svelte index 8bf32d7ac5..8e2fb98983 100644 --- a/packages/builder/src/database/FieldView.svelte +++ b/packages/builder/src/database/FieldView.svelte @@ -11,7 +11,6 @@ import DatePicker from "../common/DatePicker.svelte" import { cloneDeep, - assign, keys, isNumber, includes, @@ -60,7 +59,7 @@ errors = validate.field(allFields)(clonedField) if (errors.length > 0) return field.typeOptions = cloneDeep(clonedField.typeOptions) - onFinished(assign(field)(clonedField)) + onFinished({ ...clonedField, ...field }) } diff --git a/packages/builder/src/database/ModelView.svelte b/packages/builder/src/database/ModelView.svelte index 6abafdeb1f..eb3b7d21ad 100644 --- a/packages/builder/src/database/ModelView.svelte +++ b/packages/builder/src/database/ModelView.svelte @@ -7,7 +7,17 @@ import getIcon from "../common/icon" import FieldView from "./FieldView.svelte" import Modal from "../common/Modal.svelte" - import { map, join, filter, some, find, keys, isDate } from "lodash/fp" + import { + get, + compose, + map, + join, + filter, + some, + find, + keys, + isDate, + } from "lodash/fp" import { store, backendUiStore } from "../builderStore" import { common, hierarchy } from "../../../core/src" import { getNode } from "../common/core" @@ -37,15 +47,13 @@ store.subscribe($store => { record = $store.currentNode const flattened = hierarchy.getFlattenedHierarchy($store.hierarchy) - getIndexAllowedRecords = index => - pipe( - index.allowedRecordNodeIds, - [ - filter(id => some(n => n.nodeId === id)(flattened)), - map(id => find(n => n.nodeId === id)(flattened).name), - join(", "), - ] - ) + + getIndexAllowedRecords = compose( + join(", "), + map(id => flattened.find(n => n.nodeId === id).name), + filter(id => flattened.some(n => n.nodeId === id)), + get("allowedRecordNodeIds") + ) newField = () => { isNewField = true