Change how empty JS values are handled to avoid weird lockup
This commit is contained in:
parent
1a47365d39
commit
96aa83d454
|
@ -186,6 +186,8 @@
|
|||
}
|
||||
|
||||
const updateValue = val => {
|
||||
console.log("val", val)
|
||||
|
||||
const runtimeExpression = readableToRuntimeBinding(enrichedBindings, val)
|
||||
dispatch("change", val)
|
||||
requestEval(runtimeExpression, context, snippets)
|
||||
|
@ -236,8 +238,12 @@
|
|||
}
|
||||
|
||||
const onChangeJSValue = e => {
|
||||
jsValue = encodeJSBinding(e.detail)
|
||||
updateValue(jsValue)
|
||||
if (!e.detail?.trim()) {
|
||||
// Don't bother saving empty values as JS
|
||||
updateValue("")
|
||||
} else {
|
||||
updateValue(encodeJSBinding(e.detail))
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
} from "dataBinding"
|
||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||
import { createEventDispatcher, setContext } from "svelte"
|
||||
import { isJSBinding, decodeJSBinding } from "@budibase/string-templates"
|
||||
import { isJSBinding } from "@budibase/string-templates"
|
||||
import { builderStore } from "stores/builder"
|
||||
|
||||
export let panel = ClientBindingPanel
|
||||
|
@ -34,12 +34,7 @@
|
|||
$: isJS = isJSBinding(value)
|
||||
|
||||
const saveBinding = () => {
|
||||
// Don't bother saving empty JS expressions as JS
|
||||
let val = tempValue
|
||||
if (decodeJSBinding(tempValue)?.trim() === "") {
|
||||
val = null
|
||||
}
|
||||
onChange(val)
|
||||
onChange(tempValue)
|
||||
onBlur()
|
||||
builderStore.propertyFocus()
|
||||
bindingDrawer.hide()
|
||||
|
|
Loading…
Reference in New Issue