diff --git a/src/components/common/traffic-error-boundary.tsx b/src/components/common/traffic-error-boundary.tsx index ce7a3f61..c665e2a9 100644 --- a/src/components/common/traffic-error-boundary.tsx +++ b/src/components/common/traffic-error-boundary.tsx @@ -313,30 +313,3 @@ export const LightweightTrafficErrorBoundary: React.FC<{ ); }; - -/** - * HOC:为任何组件添加流量错误边界 - */ -export function withTrafficErrorBoundary
( - WrappedComponent: React.ComponentType
,
- options?: {
- lightweight?: boolean;
- onError?: (error: Error, errorInfo: ErrorInfo) => void;
- },
-) {
- const WithErrorBoundaryComponent = (props: P) => {
- const ErrorBoundaryComponent = options?.lightweight
- ? LightweightTrafficErrorBoundary
- : TrafficErrorBoundary;
-
- return (
-
( + WrappedComponent: React.ComponentType
,
+ options?: WithTrafficErrorBoundaryOptions,
+) {
+ const WithErrorBoundaryComponent = (props: P) => {
+ const ErrorBoundaryComponent = options?.lightweight
+ ? LightweightTrafficErrorBoundary
+ : TrafficErrorBoundary;
+
+ return (
+