Skip to content

Commit

Permalink
fix: Variable reference error issue #2249
Browse files Browse the repository at this point in the history
  • Loading branch information
scottsut committed Sep 27, 2023
1 parent cc96213 commit 04c3908
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const migrateWidgetChartConfig = (widgets: Widget[]): Widget[] => {
}
return widgets
.map(widget => {
// ------------------------------------------------
// FIXME 1.0.0-rc.3 hotfix, will remove in next version.
if (typeof widget?.config?.content?.dataChart?.config === 'string') {
widget.config.content.dataChart.config = JSON.parse(
widget.config.content.dataChart.config,
);
}
// ------------------------------------------------
if (widget?.config?.content?.dataChart?.config) {
const event_rc_2 = new MigrationEvent(APP_VERSION_RC_2, RC2);
const dispatcher_rc_2 = new MigrationEventDispatcher(event_rc_2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export const addDataChartWidgets = createAsyncThunk<
'editBoard/addDataChartWidgets',
async ({ boardId, chartIds, boardType }, { getState, dispatch }) => {
const {
data: { datacharts, views, viewVariables },
data: { datacharts: serverDataCharts, views, viewVariables },
} = await request2<{
datacharts: ServerDatachart[];
views: View[];
Expand All @@ -278,13 +278,17 @@ export const addDataChartWidgets = createAsyncThunk<
url: `viz/datacharts?datachartIds=${chartIds.join()}`,
method: 'get',
});
const dataCharts: DataChart[] = getDataChartsByServer(datacharts, views);
const dashboardDataChartMap = datacharts.reduce<
Record<string, ServerDatachart>
>((acc, cur) => {
acc[cur.id] = cur;
return acc;
}, {});
const dataCharts: DataChart[] = getDataChartsByServer(
serverDataCharts,
views,
);
const dashboardDataChartMap = dataCharts.reduce<Record<string, DataChart>>(
(acc, cur) => {
acc[cur.id] = cur;
return acc;
},
{},
);
const viewViews = getChartDataView(views, dataCharts);
dispatch(
boardActions.setDataChartToMap({ dashboardId: boardId, dataCharts }),
Expand Down

0 comments on commit 04c3908

Please sign in to comment.