Update data sources to correctly include block context suffixes in provider IDs

This commit is contained in:
Andrew Kingston 2021-11-15 12:25:01 +00:00
parent c922f4a7b9
commit 3470b1ea1b
2 changed files with 7 additions and 7 deletions

View File

@ -207,11 +207,11 @@ const getProviderContextBindings = (asset, dataProviders) => {
const keys = Object.keys(schema).sort()
// Generate safe unique runtime prefix
let runtimeId = component._id
let providerId = component._id
if (runtimeSuffix) {
runtimeId += `-${runtimeSuffix}`
providerId += `-${runtimeSuffix}`
}
const safeComponentId = makePropSafe(runtimeId)
const safeComponentId = makePropSafe(providerId)
// Create bindable properties for each schema field
keys.forEach(key => {
@ -235,7 +235,7 @@ const getProviderContextBindings = (asset, dataProviders) => {
// Field schema and provider are required to construct relationship
// datasource options, based on bindable properties
fieldSchema,
providerId: component._id,
providerId,
})
})
})

View File

@ -89,8 +89,8 @@
$: fields = bindings
.filter(x => arrayTypes.includes(x.fieldSchema?.type))
.map(binding => {
const { providerId, readableBinding, fieldSchema } = binding || {}
const { name, type, tableId } = fieldSchema || {}
const { providerId, readableBinding, runtimeBinding } = binding
const { name, type, tableId } = binding.fieldSchema
return {
providerId,
label: readableBinding,
@ -98,7 +98,7 @@
fieldType: type,
tableId,
type: "field",
value: `{{ literal ${safe(providerId)}.${safe(name)} }}`,
value: `{{ literal ${runtimeBinding} }}`,
}
})