1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +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,
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) {