Update dataprovider validation which was not aware of global bindings
This commit is contained in:
parent
8a9bb0294b
commit
c6fca37b43
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue