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/10 22:51:05 UTC

[GitHub] [superset] lyndsiWilliams commented on a change in pull request #17988: fix: Keep Report modal open when there's an error

lyndsiWilliams commented on a change in pull request #17988:
URL: https://github.com/apache/superset/pull/17988#discussion_r781634107



##########
File path: superset-frontend/src/components/ReportModal/index.tsx
##########
@@ -235,15 +244,19 @@ const ReportModal: FunctionComponent<ReportProps> = ({
       await dispatch(
         editReport(currentReport?.id, newReportValues as ReportObject),
       );
+      onHide();
     } else {
-      await dispatch(addReport(newReportValues as ReportObject));
+      try {
+        await dispatch(addReport(newReportValues as ReportObject));
+        onHide();
+      } catch (e) {
+        const parsedError = await getClientErrorObject(e);
+        const errorMessage = parsedError.message;
+        onReducerChange(ActionType.error, errorMessage);
+      }
     }
 
-    if (onReportAdd) {
-      onReportAdd();
-    }
-
-    onClose();
+    if (onReportAdd) onReportAdd();

Review comment:
       It's not preferred by prettier, I thought it was just a _prettier_ way to do it, haha. I didn't realize there were subtle errors possible with this though, thanks for this catch! I'll change it back.




-- 
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