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 => {
|
const updateValue = val => {
|
||||||
|
console.log("val", val)
|
||||||
|
|
||||||
const runtimeExpression = readableToRuntimeBinding(enrichedBindings, val)
|
const runtimeExpression = readableToRuntimeBinding(enrichedBindings, val)
|
||||||
dispatch("change", val)
|
dispatch("change", val)
|
||||||
requestEval(runtimeExpression, context, snippets)
|
requestEval(runtimeExpression, context, snippets)
|
||||||
|
@ -236,8 +238,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeJSValue = e => {
|
const onChangeJSValue = e => {
|
||||||
jsValue = encodeJSBinding(e.detail)
|
if (!e.detail?.trim()) {
|
||||||
updateValue(jsValue)
|
// Don't bother saving empty values as JS
|
||||||
|
updateValue("")
|
||||||
|
} else {
|
||||||
|
updateValue(encodeJSBinding(e.detail))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
} 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, decodeJSBinding } from "@budibase/string-templates"
|
import { isJSBinding } from "@budibase/string-templates"
|
||||||
import { builderStore } from "stores/builder"
|
import { builderStore } from "stores/builder"
|
||||||
|
|
||||||
export let panel = ClientBindingPanel
|
export let panel = ClientBindingPanel
|
||||||
|
@ -34,12 +34,7 @@
|
||||||
$: isJS = isJSBinding(value)
|
$: isJS = isJSBinding(value)
|
||||||
|
|
||||||
const saveBinding = () => {
|
const saveBinding = () => {
|
||||||
// Don't bother saving empty JS expressions as JS
|
onChange(tempValue)
|
||||||
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