Skip to content

Commit 275fc86

Browse files
authored
Merge pull request #831 from objectstack-ai/copilot/fix-object-chart-rendering
2 parents b188e5f + 588fa15 commit 275fc86

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ The `FlowDesigner` is a canvas-based flow editor that bridges the gap between th
738738
- [ ] `@object-ui/components`: ErrorBoundary wrapper per component
739739
- [ ] `@object-ui/fields`: Inline validation message rendering
740740
- [ ] `@object-ui/plugin-charts`: Drill-down click handler for chart segments
741+
- [x] `@object-ui/plugin-charts`: Fix `object-chart` crash when data is non-array — added `Array.isArray()` guards in ObjectChart, ChartRenderer, and AdvancedChartImpl to prevent Recharts `r.slice is not a function` error
741742
- [x] `@object-ui/plugin-workflow`: **FlowDesigner** — canvas-based flow editor (`flow-designer` component) with drag-to-reposition nodes, edge creation UI, undo/redo, Ctrl+S save, property panel, and BPMN export
742743
- [x] `@object-ui/plugin-workflow`: Support v3.0.9 BPMN interop types — `FlowBpmnInteropResult` with `bpmnXml` export, `nodeCount`, `edgeCount`, `warnings`
743744
- [x] `@object-ui/plugin-workflow`: Support v3.0.9 node executor descriptors — `FlowNodeExecutorDescriptor` with `inputSchema`, `outputSchema`, wait event config, retry policy

packages/plugin-charts/src/AdvancedChartImpl.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ export interface AdvancedChartImplProps {
8484
*/
8585
export default function AdvancedChartImpl({
8686
chartType = 'bar',
87-
data = [],
87+
data: rawData = [],
8888
config = {},
8989
xAxisKey = 'name',
9090
series = [],
9191
className = '',
9292
}: AdvancedChartImplProps) {
93+
const data = Array.isArray(rawData) ? rawData : [];
9394
const [isMobile, setIsMobile] = React.useState(false);
9495

9596
React.useEffect(() => {

packages/plugin-charts/src/ChartRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ schema }) => {
8989

9090
return {
9191
chartType: schema.chartType,
92-
data: schema.data,
92+
data: Array.isArray(schema.data) ? schema.data : [],
9393
config,
9494
xAxisKey,
9595
series,

packages/plugin-charts/src/ObjectChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export const ObjectChart = (props: any) => {
9898
return () => { isMounted = false; };
9999
}, [schema.objectName, dataSource, boundData, schema.data, schema.filter, schema.aggregate]);
100100

101-
const finalData = boundData || schema.data || fetchedData || [];
101+
const rawData = boundData || schema.data || fetchedData;
102+
const finalData = Array.isArray(rawData) ? rawData : [];
102103

103104
// Merge data if not provided in schema
104105
const finalSchema = {

0 commit comments

Comments
 (0)