Fix data binding after file rename

This commit is contained in:
Andrew Kingston 2020-11-19 09:31:49 +00:00
parent 261ae68907
commit e9fc20696b
1 changed files with 3 additions and 9 deletions

View File

@ -2,7 +2,7 @@
import { getContext } from "svelte"
import * as ComponentLibrary from "@budibase/standard-components"
import Router from "./Router.svelte"
import renderMustacheString from "../utils/renderMustacheString"
import enrichDataBinding from "../utils/enrichDataBinding"
const dataProviderStore = getContext("data")
@ -25,18 +25,12 @@
// Extracts valid props to pass to the real svelte component
const extractValidProps = (component, row) => {
let props = {}
const enrich = value => enrichDataBinding(value, { data: row })
Object.entries(component)
.filter(([name]) => !name.startsWith("_"))
.forEach(([key, value]) => {
props[key] = value
props[key] = row === undefined ? value : enrich(value)
})
// Enrich props if we're in a data provider context
if (row !== undefined) {
Object.entries(props).forEach(([key, value]) => {
props[key] = renderMustacheString(value, { data: row })
})
}
return props
}