Skip to content

Commit b86b41d

Browse files
committed
Refactor findOne method in ObjectStackDataSource to ensure proper type handling and unwrap response properties
1 parent e02beb3 commit b86b41d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

apps/console/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export function AppContent() {
210210
columns: 1,
211211
fields: Array.isArray(currentObjectDef.fields)
212212
? currentObjectDef.fields.map((f: any) => f.name)
213-
: Object.keys(currentObjectDef.fields || {}),
213+
: Object.keys(currentObjectDef.fields || {}).map(k => k), /* Ensure all keys are mapped */
214214
onSuccess: () => { setIsDialogOpen(false); navigate(location.pathname); },
215215
onCancel: () => setIsDialogOpen(false),
216216
showSubmit: true,

apps/console/src/dataSource.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ export class ObjectStackDataSource implements DataSource {
2323
}
2424

2525
async findOne(objectName: string, id: string): Promise<any> {
26-
const result = await this.client.data.get(objectName, id);
26+
const result: any = await this.client.data.get(objectName, id);
27+
// Unwrap 'record' or 'value' property if present (common in wrapped responses)
28+
if (result && typeof result === 'object') {
29+
if (result.record) return result.record;
30+
if (result.value) return result.value;
31+
}
2732
return result;
2833
}
2934

0 commit comments

Comments
 (0)