Skip to content

Commit 583ddc4

Browse files
committed
Refactor DashboardRenderer to enhance widget schema handling; spread options into top-level props for generic widgets
1 parent eb3e177 commit 583ddc4

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

examples/crm/src/objects/opportunity.object.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ export const OpportunityObject = ObjectSchema.create({
3636
groupField: 'stage',
3737
titleField: 'name',
3838
cardFields: ['amount', 'account', 'close_date']
39-
} as any,
40-
chart: {
41-
label: 'By Stage',
42-
type: 'chart',
43-
chartType: 'bar',
44-
xAxisField: 'stage',
45-
yAxisFields: ['amount'],
46-
aggregation: 'sum'
4739
} as any
4840
}
4941
});

packages/plugin-dashboard/src/DashboardRenderer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ export const DashboardRenderer = forwardRef<HTMLDivElement, { schema: DashboardS
7676
};
7777
}
7878

79-
return widget; // Fallback to widget itself as schema
79+
// For generic widgets (like 'metric'), we simply spread the options into the schema
80+
// so they appear as top-level props for the component.
81+
return {
82+
...widget,
83+
...((widget as any).options || {})
84+
};
8085
};
8186

8287
const componentSchema = getComponentSchema();

0 commit comments

Comments
 (0)