@rh-support/components 2.6.26 → 2.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
1
|
+
import React, { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
2
|
import { IErrorMsgInfo } from './ErrorBoundaryFallbackComponent';
|
|
3
3
|
interface IProps {
|
|
4
|
-
children: React.PropsWithChildren |
|
|
4
|
+
children: React.PropsWithChildren | ReactNode;
|
|
5
5
|
sentryAppName?: string;
|
|
6
6
|
FallbackComponent?: React.ElementType;
|
|
7
7
|
errorMsgInfo?: IErrorMsgInfo;
|
|
@@ -11,27 +11,11 @@ interface IProps {
|
|
|
11
11
|
interface IState {
|
|
12
12
|
hasError: boolean;
|
|
13
13
|
}
|
|
14
|
-
declare global {
|
|
15
|
-
interface Window {
|
|
16
|
-
app: string;
|
|
17
|
-
sessionjs: any;
|
|
18
|
-
supportVersionInfo: {
|
|
19
|
-
packageVersion: string;
|
|
20
|
-
hydrajs: string;
|
|
21
|
-
};
|
|
22
|
-
seVersionInfo: {
|
|
23
|
-
packageVersion: string;
|
|
24
|
-
hydrajs: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
14
|
export declare class ErrorBoundary extends Component<IProps, IState> {
|
|
29
|
-
constructor(props:
|
|
30
|
-
static getDerivedStateFromError():
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
componentDidCatch(error: Error, errorInfo: any): void;
|
|
34
|
-
render(): React.JSX.Element;
|
|
15
|
+
constructor(props: IProps);
|
|
16
|
+
static getDerivedStateFromError(): IState;
|
|
17
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
18
|
+
render(): ReactNode;
|
|
35
19
|
}
|
|
36
20
|
export {};
|
|
37
21
|
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/ErrorBoundary/ErrorBoundary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/ErrorBoundary/ErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAkC,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjG,UAAU,MAAM;IACZ,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACtC,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5D;AAED,UAAU,MAAM;IACZ,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC5C,KAAK,EAAE,MAAM;IAKzB,MAAM,CAAC,wBAAwB,IAAI,MAAM;IAIzC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAmB3D,MAAM,IAAI,SAAS;CAetB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getAppVersion } from '@rh-support/utils';
|
|
1
|
+
import { sendToSentry } from '@rh-support/utils';
|
|
3
2
|
import React, { Component } from 'react';
|
|
4
3
|
import { ErrorBoundaryFallbackComponent } from './ErrorBoundaryFallbackComponent';
|
|
5
4
|
export class ErrorBoundary extends Component {
|
|
@@ -8,33 +7,33 @@ export class ErrorBoundary extends Component {
|
|
|
8
7
|
this.state = { hasError: false };
|
|
9
8
|
}
|
|
10
9
|
static getDerivedStateFromError() {
|
|
11
|
-
// Update state so the next render will show the fallback UI.
|
|
12
10
|
return { hasError: true };
|
|
13
11
|
}
|
|
14
12
|
componentDidCatch(error, errorInfo) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
var _a;
|
|
14
|
+
try {
|
|
15
|
+
const { onError } = this.props;
|
|
16
|
+
if (typeof onError === 'function') {
|
|
17
|
+
try {
|
|
18
|
+
onError.call(this, error, (_a = errorInfo.componentStack) !== null && _a !== void 0 ? _a : '');
|
|
19
|
+
}
|
|
20
|
+
catch (ignoredError) {
|
|
21
|
+
const errorObj = ignoredError instanceof Error ? ignoredError : new Error(String(ignoredError));
|
|
22
|
+
sendToSentry(errorObj, { error: `Error boundary function component: ${errorObj.message}` });
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
sendToSentry(error, { error: `Error boundary component: ${error.message}` });
|
|
26
|
+
}
|
|
27
|
+
catch (sentryError) {
|
|
28
|
+
// Never let Sentry reporting break the error boundary fallback UI
|
|
29
|
+
console.error('Error reporting to Sentry from ErrorBoundary:', sentryError);
|
|
23
30
|
}
|
|
24
|
-
// log error to sentry
|
|
25
|
-
window.sessionjs.reportProblem(error, {
|
|
26
|
-
tags: {
|
|
27
|
-
portal_app: window.app || this.props.sentryAppName || 'Portal Case Management',
|
|
28
|
-
package_version: getAppVersion(),
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
31
|
}
|
|
32
32
|
render() {
|
|
33
33
|
const { children, FallbackComponent } = this.props;
|
|
34
34
|
if (this.state.hasError) {
|
|
35
|
-
return
|
|
35
|
+
return FallbackComponent ? (React.createElement(FallbackComponent, null)) : (React.createElement(ErrorBoundaryFallbackComponent, Object.assign({ isPageLevelError: this.props.isPageLevelError }, this.props.errorMsgInfo)));
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
return React.createElement(React.Fragment, null, children || null);
|
|
37
|
+
return (children || null);
|
|
39
38
|
}
|
|
40
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.28",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@patternfly/react-icons": "6.2.1",
|
|
63
63
|
"@patternfly/react-table": "6.2.1",
|
|
64
64
|
"@rh-support/types": "2.0.31",
|
|
65
|
-
"@rh-support/user-permissions": "2.6.
|
|
66
|
-
"@rh-support/utils": "2.6.
|
|
65
|
+
"@rh-support/user-permissions": "2.6.26",
|
|
66
|
+
"@rh-support/utils": "2.6.25",
|
|
67
67
|
"dompurify": "^2.2.6",
|
|
68
68
|
"js-worker-search": "^1.4.1",
|
|
69
69
|
"lazysizes": "^5.3.2",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"defaults and supports es6-module",
|
|
104
104
|
"maintained node versions"
|
|
105
105
|
],
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "3a73c83f1d0dc4d76cb2a83041dd6438501e70f4"
|
|
107
107
|
}
|