1
0
Fork 0
mirror of synced 2024-09-09 22:16:26 +12:00

Don't save empty JS expressions as JS

This commit is contained in:
Andrew Kingston 2024-05-22 10:04:54 +01:00
parent 7a6863763a
commit 1a47365d39

View file

@ -4,10 +4,9 @@
readableToRuntimeBinding,
runtimeToReadableBinding,
} from "dataBinding"
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { createEventDispatcher, setContext } from "svelte"
import { isJSBinding } from "@budibase/string-templates"
import { isJSBinding, decodeJSBinding } from "@budibase/string-templates"
import { builderStore } from "stores/builder"
export let panel = ClientBindingPanel
@ -35,7 +34,12 @@
$: isJS = isJSBinding(value)
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()
builderStore.propertyFocus()
bindingDrawer.hide()