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/11 06:27:30 UTC

[GitHub] [superset] etr2460 commented on a change in pull request #17908: chore: migrate ErrorBoundary component from jsx to tsx

etr2460 commented on a change in pull request #17908:
URL: https://github.com/apache/superset/pull/17908#discussion_r781789065



##########
File path: superset-frontend/src/components/ErrorBoundary/index.tsx
##########
@@ -17,27 +17,30 @@
  * under the License.
  */
 import React from 'react';
-import PropTypes from 'prop-types';
 import { t } from '@superset-ui/core';
 import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
 
-const propTypes = {
-  children: PropTypes.node.isRequired,
-  onError: PropTypes.func,
-  showMessage: PropTypes.bool,
-};
-const defaultProps = {
-  onError: () => {},
-  showMessage: true,
-};
+interface ErrorBoundaryProps {
+  children: React.ReactNode;
+  onError?: Function;
+  showMessage?: boolean;
+}
+
+export default class ErrorBoundary extends React.Component<
+  ErrorBoundaryProps,
+  { error: Error | null; info: React.ErrorInfo | null }

Review comment:
       Maybe let's make this into an `ErrorBoundaryState` too?

##########
File path: superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
##########
@@ -82,7 +82,7 @@ const LeftSideContent = styled.div`
 
 interface ErrorAlertProps {
   body: ReactNode;
-  copyText?: string;
+  copyText?: string | JSX.Element;

Review comment:
       is this change intentional?

##########
File path: superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx
##########
@@ -30,8 +30,8 @@ type Props = {
   error?: SupersetError;
   link?: string;
   subtitle?: React.ReactNode;
-  copyText?: string;
-  stackTrace?: string;
+  copyText?: string | JSX.Element;

Review comment:
       same question here




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