Include static formula fields in related table bindings

This commit is contained in:
Andrew Kingston 2025-04-15 16:46:23 +01:00
parent c9cf9ad506
commit 13b2d5c16a
No known key found for this signature in database
1 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { FieldType } from "@budibase/types" import { FieldType, FormulaType } 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"
@ -8,7 +8,6 @@ import { makeReadableKeyPropSafe } from "@/dataBinding"
const MAX_DEPTH = 1 const MAX_DEPTH = 1
const TYPES_TO_SKIP = [ const TYPES_TO_SKIP = [
FieldType.FORMULA,
FieldType.AI, FieldType.AI,
FieldType.LONGFORM, FieldType.LONGFORM,
FieldType.SIGNATURE_SINGLE, FieldType.SIGNATURE_SINGLE,
@ -17,6 +16,18 @@ const TYPES_TO_SKIP = [
FieldType.INTERNAL, FieldType.INTERNAL,
] ]
const shouldSkipFieldSchema = fieldSchema => {
// Skip some types always
if (TYPES_TO_SKIP.includes(fieldSchema.type)) {
return true
}
// Skip dynamic formula fields
return (
fieldSchema.type === FieldType.FORMULA &&
fieldSchema.formulaType === FormulaType.DYNAMIC
)
}
export function getBindings({ export function getBindings({
table, table,
path = null, path = null,
@ -32,7 +43,7 @@ export function getBindings({
// skip relationships after a certain depth and types which // skip relationships after a certain depth and types which
// can't bind to // can't bind to
if ( if (
TYPES_TO_SKIP.includes(schema.type) || shouldSkipFieldSchema(schema) ||
(isRelationship && depth >= MAX_DEPTH) (isRelationship && depth >= MAX_DEPTH)
) { ) {
continue continue