1
0
Fork 0
mirror of synced 2024-06-29 19:41:03 +12:00

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

View file

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