Update dataprovider validation which was not aware of global bindings

This commit is contained in:
Andrew Kingston 2024-03-21 16:05:02 +00:00
parent 8a9bb0294b
commit c6fca37b43
1 changed files with 4 additions and 5 deletions

View File

@ -11,6 +11,7 @@ import {
findComponentParent,
findAllMatchingComponents,
makeComponentUnique,
findComponentType,
} from "helpers/components"
import { getComponentFieldOptions } from "helpers/formFields"
import { selectedScreen } from "./screens"
@ -279,12 +280,10 @@ export class ComponentStore extends BudiStore {
else {
if (setting.type === "dataProvider") {
// Validate data provider exists, or else clear it
const treeId = parent?._id || component._id
const path = findComponentPath(screen?.props, treeId)
const providers = path.filter(component =>
component._component?.endsWith("/dataprovider")
const providers = findAllMatchingComponents(
screen?.props,
x => x._component === "@budibase/standard-components/dataprovider"
)
// Validate non-empty values
const valid = providers?.some(dp => value.includes?.(dp._id))
if (!valid) {
if (providers.length) {