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,
|
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) {
|
||||||
|
|
Loading…
Reference in New Issue