From 3470b1ea1bcaa8bcc3df706b0d7476df0a9229bb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 15 Nov 2021 12:25:01 +0000 Subject: [PATCH] Update data sources to correctly include block context suffixes in provider IDs --- packages/builder/src/builderStore/dataBinding.js | 8 ++++---- .../PropertyControls/DataSourceSelect.svelte | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index e63e922f4f..9a41ad2afc 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -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, }) }) }) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte index f12710e70d..bc15110c09 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte @@ -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} }}`, } })