diff --git a/packages/core/src/data_sources/model/ComponentWithCollectionsState.ts b/packages/core/src/data_sources/model/ComponentWithCollectionsState.ts index ea308df5e..e9db448b7 100644 --- a/packages/core/src/data_sources/model/ComponentWithCollectionsState.ts +++ b/packages/core/src/data_sources/model/ComponentWithCollectionsState.ts @@ -105,14 +105,14 @@ export default class ComponentWithCollectionsState extends Com switch (true) { case isObject(dataSource) && dataSource instanceof DataSource: { const id = dataSource.get('id')!; - return this.listDataSourceVariables(id); + return this.getDataSourceRecordsItems(id); } case isDataVariable(dataSource): { const path = dataSource.path; if (!path) return []; const isDataSourceId = path.split('.').length === 1; if (isDataSourceId) { - return this.listDataSourceVariables(path); + return this.getDataSourceRecordsItems(path); } else { return em.DataSources.getValue(path, []); } @@ -132,14 +132,10 @@ export default class ComponentWithCollectionsState extends Com this.dataSourceWatcher = undefined; } - private listDataSourceVariables(path: string): DataVariableProps[] { + private getDataSourceRecordsItems(path: string): any[] { const records = this.em.DataSources.getValue(path, []); - const keys = Object.keys(records); - return keys.map((key) => ({ - type: DataVariableType, - path: path + '.' + key, - })); + return Object.entries(records).map(([_, value]) => value); } destroy(options?: ObjectAny): false | JQueryXHR {