From b6181addd9166417474ed688372711b0eea4f443 Mon Sep 17 00:00:00 2001 From: mohamedsalem401 Date: Tue, 9 Sep 2025 01:31:32 +0300 Subject: [PATCH] Fix componentWithCollectionsState --- .../model/ComponentWithCollectionsState.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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 {