Skip to content

Commit 04c3908

Browse files
committed
fix: Variable reference error issue #2249
1 parent cc96213 commit 04c3908

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

frontend/src/app/migration/BoardConfig/migrateWidgetChartConfig.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ const migrateWidgetChartConfig = (widgets: Widget[]): Widget[] => {
2828
}
2929
return widgets
3030
.map(widget => {
31+
// ------------------------------------------------
32+
// FIXME 1.0.0-rc.3 hotfix, will remove in next version.
33+
if (typeof widget?.config?.content?.dataChart?.config === 'string') {
34+
widget.config.content.dataChart.config = JSON.parse(
35+
widget.config.content.dataChart.config,
36+
);
37+
}
38+
// ------------------------------------------------
3139
if (widget?.config?.content?.dataChart?.config) {
3240
const event_rc_2 = new MigrationEvent(APP_VERSION_RC_2, RC2);
3341
const dispatcher_rc_2 = new MigrationEventDispatcher(event_rc_2);

frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/thunk.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export const addDataChartWidgets = createAsyncThunk<
269269
'editBoard/addDataChartWidgets',
270270
async ({ boardId, chartIds, boardType }, { getState, dispatch }) => {
271271
const {
272-
data: { datacharts, views, viewVariables },
272+
data: { datacharts: serverDataCharts, views, viewVariables },
273273
} = await request2<{
274274
datacharts: ServerDatachart[];
275275
views: View[];
@@ -278,13 +278,17 @@ export const addDataChartWidgets = createAsyncThunk<
278278
url: `viz/datacharts?datachartIds=${chartIds.join()}`,
279279
method: 'get',
280280
});
281-
const dataCharts: DataChart[] = getDataChartsByServer(datacharts, views);
282-
const dashboardDataChartMap = datacharts.reduce<
283-
Record<string, ServerDatachart>
284-
>((acc, cur) => {
285-
acc[cur.id] = cur;
286-
return acc;
287-
}, {});
281+
const dataCharts: DataChart[] = getDataChartsByServer(
282+
serverDataCharts,
283+
views,
284+
);
285+
const dashboardDataChartMap = dataCharts.reduce<Record<string, DataChart>>(
286+
(acc, cur) => {
287+
acc[cur.id] = cur;
288+
return acc;
289+
},
290+
{},
291+
);
288292
const viewViews = getChartDataView(views, dataCharts);
289293
dispatch(
290294
boardActions.setDataChartToMap({ dashboardId: boardId, dataCharts }),

0 commit comments

Comments
 (0)