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

View File

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