From 259fcdf58b8e3699b4b5694631228da272b87c8b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 25 Aug 2022 09:47:04 +0100 Subject: [PATCH] Add legacy compatibility for string-only datasources --- packages/builder/src/builderStore/dataBinding.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index bf2d75b5bc..7f79fb88bc 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -240,7 +240,19 @@ export const getDatasourceForProvider = (asset, component) => { if (!datasourceSetting) { return null } - return component[datasourceSetting?.key] + + // For legacy compatibility, we need to be able to handle datasources that are + // just strings. These are not generated any more, so could be removed in + // future. + // TODO: remove at some point + const datasource = component[datasourceSetting?.key] + if (typeof datasource === "string") { + return { + tableId: datasource, + type: "table", + } + } + return datasource } /**