diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 57cadb365a..5a091d9ed3 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -50,6 +50,14 @@ export const getBackendUiStore = () => { }), }, models: { + fetch: async () => { + const modelsResponse = await api.get(`/api/models`) + const models = await modelsResponse.json() + store.update(state => { + state.models = models + return state + }) + }, select: model => store.update(state => { state.selectedModel = model diff --git a/packages/builder/src/components/common/Notification/NotificationDisplay.svelte b/packages/builder/src/components/common/Notification/NotificationDisplay.svelte index 4abcffef57..425eb60fb2 100644 --- a/packages/builder/src/components/common/Notification/NotificationDisplay.svelte +++ b/packages/builder/src/components/common/Notification/NotificationDisplay.svelte @@ -59,6 +59,7 @@ .content { padding: 10px; display: block; + color: var(--white); font-weight: 500; } diff --git a/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte b/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte index 61476849df..ae391ca05f 100644 --- a/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte @@ -18,6 +18,7 @@ function addField(blockDefinition) { backendUiStore.actions.models.addField(blockDefinition) + backendUiStore.actions.models.fetch() } diff --git a/packages/server/src/api/controllers/record.js b/packages/server/src/api/controllers/record.js index d4e70b3ed4..3d77d95f3b 100644 --- a/packages/server/src/api/controllers/record.js +++ b/packages/server/src/api/controllers/record.js @@ -45,7 +45,7 @@ exports.save = async function(ctx) { // create links in other tables for (let key in record) { - if (Array.isArray(record[key])) { + if (model.schema[key].type === "link") { const linked = await db.allDocs({ include_docs: true, keys: record[key],