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

Change how empty JS values are handled to avoid weird lockup

This commit is contained in:
Andrew Kingston 2024-05-22 10:15:09 +01:00
parent 1a47365d39
commit 96aa83d454
2 changed files with 10 additions and 9 deletions

View file

@ -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(() => {

View file

@ -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()