You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/24 18:27:18 UTC

[GitHub] [superset] betodealmeida commented on a change in pull request #18131: refactor(reports): refactoring reports

betodealmeida commented on a change in pull request #18131:
URL: https://github.com/apache/superset/pull/18131#discussion_r791037936



##########
File path: superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
##########
@@ -46,21 +47,17 @@ export default function HeaderReportActionsDropDown({
   chart?: ChartState;
 }) {
   const dispatch = useDispatch();
-  const report: AlertObject = useSelector<any, AlertObject>(state => {
+
+  const findReport = useSelector<any, AlertObject>(state => {
     if (dashboardId) {
       return state.reports.dashboards?.[dashboardId];
     }
     if (chart?.id) {
-      return state.reports.charts?.[chart.id];
+      return state.reports.charts?.[chart?.id];
     }
     return {};
   });
-  // const report: ReportObject = Object.values(reports).filter(report => {
-  //   if (dashboardId) {
-  //     return report.dashboards?.[dashboardId];
-  //   }
-  //   // return report.charts?.[chart?.id]
-  // })[0];
+  const report = findReport;

Review comment:
       If `report = findReport` just use `findReport` wherever you'd use `report`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org