fix optional chaining error and adds guard for no model selected.

This commit is contained in:
kevmodrome 2020-10-08 17:45:47 +02:00
parent 7b92482a8d
commit 48d7ff19c9
No known key found for this signature in database
GPG Key ID: E8F9CD141E63BF38
4 changed files with 30 additions and 26 deletions

View File

@ -113,7 +113,6 @@
</div>
</div>
<DropdownMenu
class="menu"
bind:this={dropdown}
on:click={hideDropdown}
width="170px"

View File

@ -16,13 +16,13 @@
"@budibase/client": "^0.1.25",
"@rollup/plugin-commonjs": "^11.1.0",
"lodash": "^4.17.15",
"rollup": "^1.11.0",
"rollup": "^2.11.2",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-livereload": "^1.0.1",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-postcss": "^3.1.5",
"rollup-plugin-svelte": "^5.0.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^7.0.2",
"shortid": "^2.2.15",
"sirv-cli": "^0.4.4",

View File

@ -2,6 +2,7 @@ import svelte from "rollup-plugin-svelte"
import resolve from "rollup-plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"
import postcss from "rollup-plugin-postcss"
import { terser } from "rollup-plugin-terser";
const lodash_fp_exports = ["isEmpty"]
@ -16,6 +17,7 @@ export default {
},
],
plugins: [
terser(),
postcss({
plugins: [],
}),

View File

@ -24,6 +24,7 @@
let model
onMount(async () => {
if (datasource.modelId) {
const jsonModel = await _bb.api.get(`/api/models/${datasource.modelId}`)
model = await jsonModel.json()
const { schema } = model
@ -40,13 +41,15 @@
hide: shouldHideField(key),
sortable: true,
editable:
schema[key].type !== "boolean" && schema[key].type !== "attachment",
schema[key].type !== "boolean" &&
schema[key].type !== "attachment",
cellRenderer: renderers.get(schema[key].type),
autoHeight: schema[key].type === "attachment",
}
})
}
dataLoaded = true
}
})
const shouldHideField = name => {