Don't save empty JS expressions as JS
This commit is contained in:
parent
7a6863763a
commit
1a47365d39
|
@ -4,10 +4,9 @@
|
||||||
readableToRuntimeBinding,
|
readableToRuntimeBinding,
|
||||||
runtimeToReadableBinding,
|
runtimeToReadableBinding,
|
||||||
} from "dataBinding"
|
} from "dataBinding"
|
||||||
|
|
||||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||||
import { createEventDispatcher, setContext } from "svelte"
|
import { createEventDispatcher, setContext } from "svelte"
|
||||||
import { isJSBinding } from "@budibase/string-templates"
|
import { isJSBinding, decodeJSBinding } from "@budibase/string-templates"
|
||||||
import { builderStore } from "stores/builder"
|
import { builderStore } from "stores/builder"
|
||||||
|
|
||||||
export let panel = ClientBindingPanel
|
export let panel = ClientBindingPanel
|
||||||
|
@ -35,7 +34,12 @@
|
||||||
$: isJS = isJSBinding(value)
|
$: isJS = isJSBinding(value)
|
||||||
|
|
||||||
const saveBinding = () => {
|
const saveBinding = () => {
|
||||||
onChange(tempValue)
|
// Don't bother saving empty JS expressions as JS
|
||||||
|
let val = tempValue
|
||||||
|
if (decodeJSBinding(tempValue)?.trim() === "") {
|
||||||
|
val = null
|
||||||
|
}
|
||||||
|
onChange(val)
|
||||||
onBlur()
|
onBlur()
|
||||||
builderStore.propertyFocus()
|
builderStore.propertyFocus()
|
||||||
bindingDrawer.hide()
|
bindingDrawer.hide()
|
||||||
|
|
Loading…
Reference in New Issue