Don't save empty JS expressions as JS
This commit is contained in:
parent
7a6863763a
commit
1a47365d39
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue