Handle whitespaces on complex keys in formulas

This commit is contained in:
Adria Navarro 2025-02-28 10:27:36 +01:00
parent f9d9722adb
commit d7702810c2
2 changed files with 5 additions and 6 deletions

View File

@ -2,6 +2,7 @@ import { FieldType } from "@budibase/types"
import { FIELDS } from "@/constants/backend"
import { tables } from "@/stores/builder"
import { get as svelteGet } from "svelte/store"
import { makeReadableKeyPropSafe } from "@/dataBinding"
// currently supported level of relationship depth (server side)
const MAX_DEPTH = 1
@ -62,11 +63,9 @@ export function getBindings({
const label = path == null ? column : `${path}.0.${column}`
const binding = path == null ? `[${column}]` : `[${path}].0.[${column}]`
let readableBinding = label
if (readableBinding.includes(" ")) {
readableBinding = `[${readableBinding}]`
}
const readableBinding = (path == null ? [column] : [path, "0", column])
.map(makeReadableKeyPropSafe)
.join(".")
// only supply a description for relationship paths
const description =

View File

@ -373,7 +373,7 @@ const getContextBindings = (asset, componentId) => {
.flat()
}
const makeReadableKeyPropSafe = key => {
export const makeReadableKeyPropSafe = key => {
if (!key.includes(" ")) {
return key
}