You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by aa...@apache.org on 2022/02/09 23:03:11 UTC

[superset] 03/18: fix: Header Actions test refactor (#16336)

This is an automated email from the ASF dual-hosted git repository.

aafghahi pushed a commit to branch refactorReports
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6d89d8c77ce21eb70dea8ee85c52500929a8f519
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Thu Aug 19 13:23:42 2021 -0400

    fix: Header Actions test refactor (#16336)
    
    * fixed tests
    
    * Update index.tsx
    
    Co-authored-by: Elizabeth Thompson <es...@gmail.com>
---
 .../src/components/ReportModal/HeaderReportActionsDropdown/index.tsx  | 4 ++--
 superset-frontend/src/dashboard/components/Header/Header.test.tsx     | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
index bbc30c8..026a262 100644
--- a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
+++ b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
@@ -49,8 +49,8 @@ export default function HeaderReportActionsDropDown({
     any,
     UserWithPermissionsAndRoles
   >(state => state.user || state.explore?.user);
-  const reportsIds = Object.keys(reports);
-  const report: AlertObject = reports[reportsIds[0]];
+  const reportsIds = Object.keys(reports || []);
+  const report: AlertObject = reports?.[reportsIds[0]];
   const [
     currentReportDeleting,
     setCurrentReportDeleting,
diff --git a/superset-frontend/src/dashboard/components/Header/Header.test.tsx b/superset-frontend/src/dashboard/components/Header/Header.test.tsx
index ea94ace..1a7ae85 100644
--- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx
+++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx
@@ -57,6 +57,7 @@ const createProps = () => ({
   dashboardTitle: 'Dashboard Title',
   charts: {},
   layout: {},
+  reports: {},
   expandedSlices: {},
   css: '',
   customCss: '',