Add legacy compatibility for string-only datasources

This commit is contained in:
Andrew Kingston 2022-08-25 09:47:04 +01:00
parent 0fe73e3b4d
commit d9d01b1d17
1 changed files with 13 additions and 1 deletions

View File

@ -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
}
/**