From d31f19f754ec0e0b67928626f1cca934d2b6cacb Mon Sep 17 00:00:00 2001 From: Antonio Rivero Date: Mon, 18 Jul 2022 14:41:21 -0300 Subject: [PATCH] Reports: - dashboardInfo might be an empty object, in which case we must use the chart info instead so the resourceId is not undefined --- superset-frontend/src/reports/actions/reports.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/reports/actions/reports.js b/superset-frontend/src/reports/actions/reports.js index 6fbd8ca4ec0f2..96a435ec5da3a 100644 --- a/superset-frontend/src/reports/actions/reports.js +++ b/superset-frontend/src/reports/actions/reports.js @@ -23,6 +23,7 @@ import { addDangerToast, addSuccessToast, } from 'src/components/MessageToasts/actions'; +import { isEmpty } from 'lodash'; export const SET_REPORT = 'SET_REPORT'; export function setReport(report, resourceId, creationMethod, filterField) { @@ -76,7 +77,7 @@ export function fetchUISpecificReport({ const structureFetchAction = (dispatch, getState) => { const state = getState(); const { user, dashboardInfo, charts, explore } = state; - if (dashboardInfo) { + if (!isEmpty(dashboardInfo)) { dispatch( fetchUISpecificReport({ userId: user.userId, @@ -89,7 +90,7 @@ const structureFetchAction = (dispatch, getState) => { const [chartArr] = Object.keys(charts); dispatch( fetchUISpecificReport({ - userId: explore.user.userId, + userId: explore.user?.userId || user?.userId, filterField: 'chart_id', creationMethod: 'charts', resourceId: charts[chartArr].id,