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

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


The following commit(s) were added to refs/heads/refactorReports by this push:
     new 0f36532  refactor: Reports - ReportModal (#16622)
0f36532 is described below

commit 0f36532016c02fb13735ebf57233d33d6dd9b8a2
Author: Lyndsi Kay Williams <[email protected]>
AuthorDate: Thu Sep 23 14:59:36 2021 -0500

    refactor: Reports - ReportModal (#16622)
    
    * refactoring progress
    
    * removed consoles
    
    * Working, but with 2 fetches
---
 .../HeaderReportActionsDropdown/index.tsx          | 37 ++++++++++++----------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git 
a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
 
b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
index f9fdca0..b81f225 100644
--- 
a/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
+++ 
b/superset-frontend/src/components/ReportModal/HeaderReportActionsDropdown/index.tsx
@@ -92,6 +92,7 @@ export default function HeaderReportActionsDropDown({
 
   useEffect(() => {
     if (canAddReports()) {
+      dashboardIdRef.current = dashboardId;
       dispatch(
         fetchUISpecificReport({
           userId: user.userId,
@@ -101,25 +102,27 @@ export default function HeaderReportActionsDropDown({
         }),
       );
     }
-  }, []);
-
-  useEffect(() => {
-    if (
-      canAddReports() &&
-      dashboardId &&
-      dashboardId !== dashboardIdRef.current
-    ) {
-      dispatch(
-        fetchUISpecificReport({
-          userId: user.userId,
-          filterField: 'dashboard_id',
-          creationMethod: 'dashboards',
-          resourceId: dashboardId,
-        }),
-      );
-    }
   }, [dashboardId]);
 
+  // (TODO: lyndsiWilliams): Leaving this in case we decide we need it after 
all
+  // useEffect(() => {
+  //   if (
+  //     canAddReports() &&
+  //     dashboardId &&
+  //     dashboardId !== dashboardIdRef.current
+  //   ) {
+  //     dashboardIdRef.current = dashboardId;
+  //     dispatch(
+  //       fetchUISpecificReport({
+  //         userId: user.userId,
+  //         filterField: 'dashboard_id',
+  //         creationMethod: 'dashboards',
+  //         resourceId: dashboardId,
+  //       }),
+  //     );
+  //   }
+  // }, [dashboardId]);
+
   const menu = () => (
     <Menu selectable={false} css={{ width: '200px' }}>
       <Menu.Item>

Reply via email to