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

View File

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